diff options
| author | bors <bors@rust-lang.org> | 2021-10-08 14:35:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-08 14:35:00 +0000 |
| commit | 87df4dd70f13f248a4d2d22cdd96ee59d161d741 (patch) | |
| tree | 110a26575bdae65e6cdd9566738aaec9e65e4e57 | |
| parent | e0aaffd8a45cd0e9f331ec7734713e9de11aa6c8 (diff) | |
| parent | ff6601e0fc4dd05e337ebc4e0d3c741a0ef26078 (diff) | |
| download | rust-87df4dd70f13f248a4d2d22cdd96ee59d161d741.tar.gz rust-87df4dd70f13f248a4d2d22cdd96ee59d161d741.zip | |
Auto merge of #89644 - matthiaskrgr:clippy_perf_okt, r=jyn514
some clippy::perf fixes
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/cast.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_typeck/src/check/expr.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 79f46be73f6..3d29d305021 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1096,7 +1096,7 @@ impl<'a> Parser<'a> { (Err(ref mut err), Some((mut snapshot, ExprKind::Path(None, path)))) => { let name = pprust::path_to_string(&path); snapshot.bump(); // `(` - match snapshot.parse_struct_fields(path.clone(), false, token::Paren) { + match snapshot.parse_struct_fields(path, false, token::Paren) { Ok((fields, ..)) if snapshot.eat(&token::CloseDelim(token::Paren)) => { // We have are certain we have `Enum::Foo(a: 3, b: 4)`, suggest // `Enum::Foo { a: 3, b: 4 }` or `Enum::Foo(3, 4)`. diff --git a/compiler/rustc_typeck/src/check/cast.rs b/compiler/rustc_typeck/src/check/cast.rs index 51c766fe57c..78849b276d6 100644 --- a/compiler/rustc_typeck/src/check/cast.rs +++ b/compiler/rustc_typeck/src/check/cast.rs @@ -431,7 +431,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { .sess .source_map() .span_to_snippet(self.expr.span) - .map_or(false, |snip| snip.starts_with("(")); + .map_or(false, |snip| snip.starts_with('(')); // Very crude check to see whether the expression must be wrapped // in parentheses for the suggestion to work (issue #89497). diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index 676e751376a..3846aad2cfc 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -1887,7 +1887,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; let expr_snippet = self.tcx.sess.source_map().span_to_snippet(expr.span).unwrap_or(String::new()); - let is_wrapped = expr_snippet.starts_with("(") && expr_snippet.ends_with(")"); + let is_wrapped = expr_snippet.starts_with('(') && expr_snippet.ends_with(')'); let after_open = expr.span.lo() + rustc_span::BytePos(1); let before_close = expr.span.hi() - rustc_span::BytePos(1); |
