Skip to content

Commit 87df4dd

Browse files
committed
Auto merge of #89644 - matthiaskrgr:clippy_perf_okt, r=jyn514
some clippy::perf fixes
2 parents e0aaffd + ff6601e commit 87df4dd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

compiler/rustc_parse/src/parser/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ impl<'a> Parser<'a> {
10961096
(Err(ref mut err), Some((mut snapshot, ExprKind::Path(None, path)))) => {
10971097
let name = pprust::path_to_string(&path);
10981098
snapshot.bump(); // `(`
1099-
match snapshot.parse_struct_fields(path.clone(), false, token::Paren) {
1099+
match snapshot.parse_struct_fields(path, false, token::Paren) {
11001100
Ok((fields, ..)) if snapshot.eat(&token::CloseDelim(token::Paren)) => {
11011101
// We have are certain we have `Enum::Foo(a: 3, b: 4)`, suggest
11021102
// `Enum::Foo { a: 3, b: 4 }` or `Enum::Foo(3, 4)`.

compiler/rustc_typeck/src/check/cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
431431
.sess
432432
.source_map()
433433
.span_to_snippet(self.expr.span)
434-
.map_or(false, |snip| snip.starts_with("("));
434+
.map_or(false, |snip| snip.starts_with('('));
435435

436436
// Very crude check to see whether the expression must be wrapped
437437
// in parentheses for the suggestion to work (issue #89497).

compiler/rustc_typeck/src/check/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18871887
};
18881888
let expr_snippet =
18891889
self.tcx.sess.source_map().span_to_snippet(expr.span).unwrap_or(String::new());
1890-
let is_wrapped = expr_snippet.starts_with("(") && expr_snippet.ends_with(")");
1890+
let is_wrapped = expr_snippet.starts_with('(') && expr_snippet.ends_with(')');
18911891
let after_open = expr.span.lo() + rustc_span::BytePos(1);
18921892
let before_close = expr.span.hi() - rustc_span::BytePos(1);
18931893

0 commit comments

Comments
 (0)