diff options
Diffstat (limited to 'clippy_lints/src/vec.rs')
| -rw-r--r-- | clippy_lints/src/vec.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 9edf7579d48..a831234906b 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -2,6 +2,7 @@ use std::collections::BTreeMap; use std::ops::ControlFlow; use clippy_config::msrvs::{self, Msrv}; +use clippy_config::Conf; use clippy_utils::consts::{constant, Constant}; use clippy_utils::diagnostics::span_lint_hir_and_then; use clippy_utils::source::snippet_opt; @@ -17,12 +18,21 @@ use rustc_session::impl_lint_pass; use rustc_span::{sym, DesugaringKind, Span}; #[expect(clippy::module_name_repetitions)] -#[derive(Clone)] pub struct UselessVec { - pub too_large_for_stack: u64, - pub msrv: Msrv, - pub span_to_lint_map: BTreeMap<Span, Option<(HirId, SuggestedType, String, Applicability)>>, - pub allow_in_test: bool, + too_large_for_stack: u64, + msrv: Msrv, + span_to_lint_map: BTreeMap<Span, Option<(HirId, SuggestedType, String, Applicability)>>, + allow_in_test: bool, +} +impl UselessVec { + pub fn new(conf: &'static Conf) -> Self { + Self { + too_large_for_stack: conf.too_large_for_stack, + msrv: conf.msrv.clone(), + span_to_lint_map: BTreeMap::new(), + allow_in_test: conf.allow_useless_vec_in_tests, + } + } } declare_clippy_lint! { |
