@@ -47,13 +47,13 @@ impl_lint_pass!(ManualMainSeparatorStr => [MANUAL_MAIN_SEPARATOR_STR]);
47
47
48
48
impl LateLintPass < ' _ > for ManualMainSeparatorStr {
49
49
fn check_expr ( & mut self , cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
50
- if self . msrv . meets ( msrvs:: PATH_MAIN_SEPARATOR_STR )
51
- && let ( target, _) = peel_hir_expr_refs ( expr)
52
- && is_trait_method ( cx, target, sym:: ToString )
53
- && let ExprKind :: MethodCall ( path, receiver, & [ ] , _) = target. kind
50
+ let ( target, _) = peel_hir_expr_refs ( expr) ;
51
+ if let ExprKind :: MethodCall ( path, receiver, & [ ] , _) = target. kind
54
52
&& path. ident . name == sym:: to_string
55
53
&& let ExprKind :: Path ( QPath :: Resolved ( None , path) ) = receiver. kind
56
54
&& let Res :: Def ( DefKind :: Const , receiver_def_id) = path. res
55
+ && is_trait_method ( cx, target, sym:: ToString )
56
+ && self . msrv . meets ( msrvs:: PATH_MAIN_SEPARATOR_STR )
57
57
&& match_def_path ( cx, receiver_def_id, & paths:: PATH_MAIN_SEPARATOR )
58
58
&& let ty:: Ref ( _, ty, Mutability :: Not ) = cx. typeck_results ( ) . expr_ty_adjusted ( expr) . kind ( )
59
59
&& ty. is_str ( )
0 commit comments