diff options
| author | Icxolu <10486322+Icxolu@users.noreply.github.com> | 2023-05-03 19:25:25 +0200 |
|---|---|---|
| committer | Icxolu <10486322+Icxolu@users.noreply.github.com> | 2023-05-03 19:25:25 +0200 |
| commit | 4e049036313759df55c4c68ad87e1cd7ad5cf214 (patch) | |
| tree | 7f8e330ae15e7dd82cd772f301855e84d57c8245 | |
| parent | 220a9db64215df07f730cd01322a0c8b658629cd (diff) | |
| download | rust-4e049036313759df55c4c68ad87e1cd7ad5cf214.tar.gz rust-4e049036313759df55c4c68ad87e1cd7ad5cf214.zip | |
rename to plural form
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | clippy_lints/src/declared_lints.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/default_constructed_unit_structs.rs (renamed from clippy_lints/src/default_constructed_unit_struct.rs) | 8 | ||||
| -rw-r--r-- | clippy_lints/src/lib.rs | 4 | ||||
| -rw-r--r-- | tests/ui/default_constructed_unit_structs.rs (renamed from tests/ui/default_constructed_unit_struct.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/default_constructed_unit_structs.stderr (renamed from tests/ui/default_constructed_unit_struct.stderr) | 10 |
6 files changed, 14 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 735ac59758a..31ad00536c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4582,7 +4582,7 @@ Released 2018-09-13 [`debug_assert_with_mut_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#debug_assert_with_mut_call [`decimal_literal_representation`]: https://rust-lang.github.io/rust-clippy/master/index.html#decimal_literal_representation [`declare_interior_mutable_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#declare_interior_mutable_const -[`default_constructed_unit_struct`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_struct +[`default_constructed_unit_structs`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs [`default_instead_of_iter_empty`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_instead_of_iter_empty [`default_numeric_fallback`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_numeric_fallback [`default_trait_access`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index bf30f5b52f7..d3f5cb6e5f4 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -105,7 +105,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::dbg_macro::DBG_MACRO_INFO, crate::default::DEFAULT_TRAIT_ACCESS_INFO, crate::default::FIELD_REASSIGN_WITH_DEFAULT_INFO, - crate::default_constructed_unit_struct::DEFAULT_CONSTRUCTED_UNIT_STRUCT_INFO, + crate::default_constructed_unit_structs::DEFAULT_CONSTRUCTED_UNIT_STRUCTS_INFO, crate::default_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY_INFO, crate::default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK_INFO, crate::default_union_representation::DEFAULT_UNION_REPRESENTATION_INFO, diff --git a/clippy_lints/src/default_constructed_unit_struct.rs b/clippy_lints/src/default_constructed_unit_structs.rs index d261cdd44a5..a79923e9715 100644 --- a/clippy_lints/src/default_constructed_unit_struct.rs +++ b/clippy_lints/src/default_constructed_unit_structs.rs @@ -31,13 +31,13 @@ declare_clippy_lint! { /// } /// ``` #[clippy::version = "1.71.0"] - pub DEFAULT_CONSTRUCTED_UNIT_STRUCT, + pub DEFAULT_CONSTRUCTED_UNIT_STRUCTS, complexity, "unit structs can be contructed without calling `default`" } -declare_lint_pass!(DefaultConstructedUnitStruct => [DEFAULT_CONSTRUCTED_UNIT_STRUCT]); +declare_lint_pass!(DefaultConstructedUnitStructs => [DEFAULT_CONSTRUCTED_UNIT_STRUCTS]); -impl LateLintPass<'_> for DefaultConstructedUnitStruct { +impl LateLintPass<'_> for DefaultConstructedUnitStructs { fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { if_chain!( // make sure we have a call to `Default::default` @@ -53,7 +53,7 @@ impl LateLintPass<'_> for DefaultConstructedUnitStruct { then { span_lint_and_sugg( cx, - DEFAULT_CONSTRUCTED_UNIT_STRUCT, + DEFAULT_CONSTRUCTED_UNIT_STRUCTS, expr.span.with_lo(qpath.qself_span().hi()), "use of `default` to create a unit struct", "remove this call to `default`", diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 9af0b17e27b..657a3d1f431 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -94,7 +94,7 @@ mod crate_in_macro_def; mod create_dir; mod dbg_macro; mod default; -mod default_constructed_unit_struct; +mod default_constructed_unit_structs; mod default_instead_of_iter_empty; mod default_numeric_fallback; mod default_union_representation; @@ -971,7 +971,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|_| Box::new(manual_slice_size_calculation::ManualSliceSizeCalculation)); store.register_early_pass(|| Box::new(suspicious_doc_comments::SuspiciousDocComments)); store.register_late_pass(|_| Box::new(items_after_test_module::ItemsAfterTestModule)); - store.register_late_pass(|_| Box::new(default_constructed_unit_struct::DefaultConstructedUnitStruct)); + store.register_late_pass(|_| Box::new(default_constructed_unit_structs::DefaultConstructedUnitStructs)); // add lints here, do not remove this comment, it's used in `new_lint` } diff --git a/tests/ui/default_constructed_unit_struct.rs b/tests/ui/default_constructed_unit_structs.rs index b64da9b863a..505be09a50e 100644 --- a/tests/ui/default_constructed_unit_struct.rs +++ b/tests/ui/default_constructed_unit_structs.rs @@ -1,5 +1,5 @@ #![allow(unused)] -#![warn(clippy::default_constructed_unit_struct)] +#![warn(clippy::default_constructed_unit_structs)] use std::marker::PhantomData; #[derive(Default)] diff --git a/tests/ui/default_constructed_unit_struct.stderr b/tests/ui/default_constructed_unit_structs.stderr index 952d4019644..23ffa278288 100644 --- a/tests/ui/default_constructed_unit_struct.stderr +++ b/tests/ui/default_constructed_unit_structs.stderr @@ -1,25 +1,25 @@ error: use of `default` to create a unit struct - --> $DIR/default_constructed_unit_struct.rs:39:31 + --> $DIR/default_constructed_unit_structs.rs:39:31 | LL | inner: PhantomData::default(), | ^^^^^^^^^^^ help: remove this call to `default` | - = note: `-D clippy::default-constructed-unit-struct` implied by `-D warnings` + = note: `-D clippy::default-constructed-unit-structs` implied by `-D warnings` error: use of `default` to create a unit struct - --> $DIR/default_constructed_unit_struct.rs:62:33 + --> $DIR/default_constructed_unit_structs.rs:62:33 | LL | let _ = PhantomData::<usize>::default(); | ^^^^^^^^^^^ help: remove this call to `default` error: use of `default` to create a unit struct - --> $DIR/default_constructed_unit_struct.rs:63:42 + --> $DIR/default_constructed_unit_structs.rs:63:42 | LL | let _: PhantomData<i32> = PhantomData::default(); | ^^^^^^^^^^^ help: remove this call to `default` error: use of `default` to create a unit struct - --> $DIR/default_constructed_unit_struct.rs:64:23 + --> $DIR/default_constructed_unit_structs.rs:64:23 | LL | let _ = UnitStruct::default(); | ^^^^^^^^^^^ help: remove this call to `default` |
