Combine redundant match arm bodies.

This commit is contained in:
Dan Gohman
2017-11-03 16:40:51 -07:00
parent c7f01f88b2
commit acc6d941a3
6 changed files with 14 additions and 14 deletions

View File

@@ -39,9 +39,9 @@ impl StdError for Error {
fn description(&self) -> &str {
use Error::*;
match *self {
Syntax(ref s) => s,
UndefVariable(ref s) => s,
Backref(ref s) => s,
Syntax(ref s) |
UndefVariable(ref s) |
Backref(ref s) |
DuplicateDef(ref s) => s,
Regex(ref err) => err.description(),
}

View File

@@ -45,7 +45,7 @@ impl Part {
/// Get the variabled referenced by this part, if any.
pub fn ref_var(&self) -> Option<&str> {
match *self {
Part::Var(ref var) => Some(var),
Part::Var(ref var) |
Part::DefVar { ref var, .. } => Some(var),
_ => None,
}