]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_parse/parser/expr.rs
Auto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC
[rust.git] / src / librustc_parse / parser / expr.rs
index 859e53127b7b05b1ce0b16aeb1385d91286134ef..71ca8fba0b4799195288271d75470ce2df64ac0a 100644 (file)
@@ -224,12 +224,8 @@ pub(super) fn parse_assoc_expr_with(
 
             // Make sure that the span of the parent node is larger than the span of lhs and rhs,
             // including the attributes.
-            let lhs_span = lhs
-                .attrs
-                .iter()
-                .filter(|a| a.style == AttrStyle::Outer)
-                .next()
-                .map_or(lhs_span, |a| a.span);
+            let lhs_span =
+                lhs.attrs.iter().find(|a| a.style == AttrStyle::Outer).map_or(lhs_span, |a| a.span);
             let span = lhs_span.to(rhs.span);
             lhs = match op {
                 AssocOp::Add
@@ -757,7 +753,7 @@ fn recover_field_access_by_float_lit(
                 s.print_usize(float.trunc() as usize);
                 s.pclose();
                 s.s.word(".");
-                s.s.word(fstr.splitn(2, ".").last().unwrap().to_string())
+                s.s.word(fstr.splitn(2, '.').last().unwrap().to_string())
             });
             err.span_suggestion(
                 lo.to(self.prev_span),