Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk

unused_delims: trim expr

improves rustfix output.
This commit is contained in:
Yuki Okushi 2020-08-11 16:23:57 +09:00 committed by GitHub
commit ca462d36ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 24 deletions

View File

@ -481,7 +481,8 @@ trait UnusedDelimLint {
let mut err = lint.build(&span_msg);
let mut ate_left_paren = false;
let mut ate_right_paren = false;
let parens_removed = pattern.trim_matches(|c| match c {
let parens_removed = pattern
.trim_matches(|c| match c {
'(' | '{' => {
if ate_left_paren {
false
@ -499,7 +500,8 @@ trait UnusedDelimLint {
}
}
_ => false,
});
})
.trim();
let replace = {
let mut replace = if keep_space.0 {