@@ -794,11 +794,7 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_t
794
794
}
795
795
}
796
796
797
- fn lint_extend ( cx : & LateContext , expr : & hir:: Expr , args : & MethodArgs ) {
798
- let ( obj_ty, _) = walk_ptrs_ty_depth ( cx. tcx . tables ( ) . expr_ty ( & args[ 0 ] ) ) ;
799
- if !match_type ( cx, obj_ty, & paths:: VEC ) {
800
- return ;
801
- }
797
+ fn lint_vec_extend ( cx : & LateContext , expr : & hir:: Expr , args : & MethodArgs ) {
802
798
let arg_ty = cx. tcx . tables ( ) . expr_ty ( & args[ 1 ] ) ;
803
799
if let Some ( slice) = derefs_to_slice ( cx, & args[ 1 ] , arg_ty) {
804
800
span_lint_and_then ( cx, EXTEND_FROM_SLICE , expr. span , "use of `extend` to extend a Vec by a slice" , |db| {
@@ -811,6 +807,13 @@ fn lint_extend(cx: &LateContext, expr: &hir::Expr, args: &MethodArgs) {
811
807
}
812
808
}
813
809
810
+ fn lint_extend ( cx : & LateContext , expr : & hir:: Expr , args : & MethodArgs ) {
811
+ let ( obj_ty, _) = walk_ptrs_ty_depth ( cx. tcx . tables ( ) . expr_ty ( & args[ 0 ] ) ) ;
812
+ if match_type ( cx, obj_ty, & paths:: VEC ) {
813
+ lint_vec_extend ( cx, expr, args) ;
814
+ }
815
+ }
816
+
814
817
fn lint_cstring_as_ptr ( cx : & LateContext , expr : & hir:: Expr , new : & hir:: Expr , unwrap : & hir:: Expr ) {
815
818
if_let_chain ! { [
816
819
let hir:: ExprCall ( ref fun, ref args) = new. node,
0 commit comments