11mod borrowed_box;
2- mod box_vec ;
2+ mod box_collection ;
33mod linked_list;
44mod option_option;
55mod rc_buffer;
@@ -21,12 +21,12 @@ use rustc_span::source_map::Span;
2121
2222declare_clippy_lint ! {
2323 /// ### What it does
24- /// Checks for use of `Box<Vec<_>>` anywhere in the code.
24+ /// Checks for use of `Box<T>` where T is a collection such as Vec anywhere in the code.
2525 /// Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information.
2626 ///
2727 /// ### Why is this bad?
28- /// `Vec` already keeps its contents in a separate area on
29- /// the heap. So if you `Box` it , you just add another level of indirection
28+ /// Collections already keeps their contents in a separate area on
29+ /// the heap. So if you `Box` them , you just add another level of indirection
3030 /// without any benefit whatsoever.
3131 ///
3232 /// ### Example
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343 /// values: Vec<Foo>,
4444 /// }
4545 /// ```
46- pub BOX_VEC ,
46+ pub BOX_COLLECTION ,
4747 perf,
4848 "usage of `Box<Vec<T>>`, vector elements are already on the heap"
4949}
@@ -298,7 +298,7 @@ pub struct Types {
298298 avoid_breaking_exported_api : bool ,
299299}
300300
301- impl_lint_pass ! ( Types => [ BOX_VEC , VEC_BOX , OPTION_OPTION , LINKEDLIST , BORROWED_BOX , REDUNDANT_ALLOCATION , RC_BUFFER , RC_MUTEX , TYPE_COMPLEXITY ] ) ;
301+ impl_lint_pass ! ( Types => [ BOX_COLLECTION , VEC_BOX , OPTION_OPTION , LINKEDLIST , BORROWED_BOX , REDUNDANT_ALLOCATION , RC_BUFFER , RC_MUTEX , TYPE_COMPLEXITY ] ) ;
302302
303303impl < ' tcx > LateLintPass < ' tcx > for Types {
304304 fn check_fn ( & mut self , cx : & LateContext < ' _ > , _: FnKind < ' _ > , decl : & FnDecl < ' _ > , _: & Body < ' _ > , _: Span , id : HirId ) {
@@ -447,7 +447,7 @@ impl Types {
447447 // in `clippy_lints::utils::conf.rs`
448448
449449 let mut triggered = false ;
450- triggered |= box_vec :: check ( cx, hir_ty, qpath, def_id) ;
450+ triggered |= box_collection :: check ( cx, hir_ty, qpath, def_id) ;
451451 triggered |= redundant_allocation:: check ( cx, hir_ty, qpath, def_id) ;
452452 triggered |= rc_buffer:: check ( cx, hir_ty, qpath, def_id) ;
453453 triggered |= vec_box:: check ( cx, hir_ty, qpath, def_id, self . vec_box_size_threshold ) ;
0 commit comments