Fix rustfmt according to review
This commit is contained in:
parent
962c0140c7
commit
483f9e2580
2 changed files with 14 additions and 2 deletions
|
|
@ -339,9 +339,9 @@ impl Rewrite for Pat {
|
|||
.max_width_error(shape.width, self.span)?,
|
||||
)
|
||||
.map(|inner_pat| format!("({})", inner_pat)),
|
||||
PatKind::Err(_) => Err(RewriteError::Unknown),
|
||||
PatKind::Guard(..) => Ok(context.snippet(self.span).to_string()),
|
||||
PatKind::Deref(_) => Err(RewriteError::Unknown),
|
||||
PatKind::Guard(..) => Err(RewriteError::Unknown),
|
||||
PatKind::Err(_) => Err(RewriteError::Unknown),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
src/tools/rustfmt/tests/target/guard_patterns.rs
Normal file
12
src/tools/rustfmt/tests/target/guard_patterns.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#![feature(guard_patterns)]
|
||||
|
||||
fn main() {
|
||||
match user.subscription_plan() {
|
||||
(Plan::Regular if user.credit() >= 100) | (Plan::Premium if user.credit() >= 80) => {
|
||||
// Complete the transaction.
|
||||
}
|
||||
_ => {
|
||||
// The user doesn't have enough credit, return an error message.
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue