@@ -1111,8 +1111,7 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
11111111
11121112 if [ "default" , "new" ] . contains ( & path) {
11131113 let arg_ty = cx. tables . expr_ty ( arg) ;
1114- let default_trait_id = if let Some ( default_trait_id) = get_trait_def_id ( cx, & paths:: DEFAULT_TRAIT )
1115- {
1114+ let default_trait_id = if let Some ( default_trait_id) = get_trait_def_id ( cx, & paths:: DEFAULT_TRAIT ) {
11161115 default_trait_id
11171116 } else {
11181117 return false ;
@@ -2254,33 +2253,15 @@ fn lint_chars_cmp_with_unwrap<'a, 'tcx>(
22542253
22552254/// Checks for the `CHARS_NEXT_CMP` lint with `unwrap()`.
22562255fn lint_chars_next_cmp_with_unwrap < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , info : & BinaryExprInfo < ' _ > ) -> bool {
2257- lint_chars_cmp_with_unwrap (
2258- cx,
2259- info,
2260- & [ "chars" , "next" , "unwrap" ] ,
2261- CHARS_NEXT_CMP ,
2262- "starts_with" ,
2263- )
2256+ lint_chars_cmp_with_unwrap ( cx, info, & [ "chars" , "next" , "unwrap" ] , CHARS_NEXT_CMP , "starts_with" )
22642257}
22652258
22662259/// Checks for the `CHARS_LAST_CMP` lint with `unwrap()`.
22672260fn lint_chars_last_cmp_with_unwrap < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , info : & BinaryExprInfo < ' _ > ) -> bool {
2268- if lint_chars_cmp_with_unwrap (
2269- cx,
2270- info,
2271- & [ "chars" , "last" , "unwrap" ] ,
2272- CHARS_LAST_CMP ,
2273- "ends_with" ,
2274- ) {
2261+ if lint_chars_cmp_with_unwrap ( cx, info, & [ "chars" , "last" , "unwrap" ] , CHARS_LAST_CMP , "ends_with" ) {
22752262 true
22762263 } else {
2277- lint_chars_cmp_with_unwrap (
2278- cx,
2279- info,
2280- & [ "chars" , "next_back" , "unwrap" ] ,
2281- CHARS_LAST_CMP ,
2282- "ends_with" ,
2283- )
2264+ lint_chars_cmp_with_unwrap ( cx, info, & [ "chars" , "next_back" , "unwrap" ] , CHARS_LAST_CMP , "ends_with" )
22842265 }
22852266}
22862267
@@ -2344,7 +2325,10 @@ fn lint_asref(cx: &LateContext<'_, '_>, expr: &hir::Expr, call_name: &str, as_re
23442325 }
23452326}
23462327
2347- fn ty_has_iter_method ( cx : & LateContext < ' _ , ' _ > , self_ref_ty : Ty < ' _ > ) -> Option < ( & ' static Lint , & ' static str , & ' static str ) > {
2328+ fn ty_has_iter_method (
2329+ cx : & LateContext < ' _ , ' _ > ,
2330+ self_ref_ty : Ty < ' _ > ,
2331+ ) -> Option < ( & ' static Lint , & ' static str , & ' static str ) > {
23482332 if let Some ( ty_name) = has_iter_method ( cx, self_ref_ty) {
23492333 let lint = if ty_name == "array" || ty_name == "PathBuf" {
23502334 INTO_ITER_ON_ARRAY
0 commit comments