mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
rename to plural form
This commit is contained in:
parent
220a9db642
commit
4e04903631
6 changed files with 14 additions and 14 deletions
|
@ -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
|
[`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
|
[`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
|
[`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_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_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
|
[`default_trait_access`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
|
||||||
|
|
|
@ -105,7 +105,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
|
||||||
crate::dbg_macro::DBG_MACRO_INFO,
|
crate::dbg_macro::DBG_MACRO_INFO,
|
||||||
crate::default::DEFAULT_TRAIT_ACCESS_INFO,
|
crate::default::DEFAULT_TRAIT_ACCESS_INFO,
|
||||||
crate::default::FIELD_REASSIGN_WITH_DEFAULT_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_instead_of_iter_empty::DEFAULT_INSTEAD_OF_ITER_EMPTY_INFO,
|
||||||
crate::default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK_INFO,
|
crate::default_numeric_fallback::DEFAULT_NUMERIC_FALLBACK_INFO,
|
||||||
crate::default_union_representation::DEFAULT_UNION_REPRESENTATION_INFO,
|
crate::default_union_representation::DEFAULT_UNION_REPRESENTATION_INFO,
|
||||||
|
|
|
@ -31,13 +31,13 @@ declare_clippy_lint! {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[clippy::version = "1.71.0"]
|
#[clippy::version = "1.71.0"]
|
||||||
pub DEFAULT_CONSTRUCTED_UNIT_STRUCT,
|
pub DEFAULT_CONSTRUCTED_UNIT_STRUCTS,
|
||||||
complexity,
|
complexity,
|
||||||
"unit structs can be contructed without calling `default`"
|
"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>) {
|
fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
|
||||||
if_chain!(
|
if_chain!(
|
||||||
// make sure we have a call to `Default::default`
|
// make sure we have a call to `Default::default`
|
||||||
|
@ -53,7 +53,7 @@ impl LateLintPass<'_> for DefaultConstructedUnitStruct {
|
||||||
then {
|
then {
|
||||||
span_lint_and_sugg(
|
span_lint_and_sugg(
|
||||||
cx,
|
cx,
|
||||||
DEFAULT_CONSTRUCTED_UNIT_STRUCT,
|
DEFAULT_CONSTRUCTED_UNIT_STRUCTS,
|
||||||
expr.span.with_lo(qpath.qself_span().hi()),
|
expr.span.with_lo(qpath.qself_span().hi()),
|
||||||
"use of `default` to create a unit struct",
|
"use of `default` to create a unit struct",
|
||||||
"remove this call to `default`",
|
"remove this call to `default`",
|
|
@ -94,7 +94,7 @@ mod crate_in_macro_def;
|
||||||
mod create_dir;
|
mod create_dir;
|
||||||
mod dbg_macro;
|
mod dbg_macro;
|
||||||
mod default;
|
mod default;
|
||||||
mod default_constructed_unit_struct;
|
mod default_constructed_unit_structs;
|
||||||
mod default_instead_of_iter_empty;
|
mod default_instead_of_iter_empty;
|
||||||
mod default_numeric_fallback;
|
mod default_numeric_fallback;
|
||||||
mod default_union_representation;
|
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_late_pass(|_| Box::new(manual_slice_size_calculation::ManualSliceSizeCalculation));
|
||||||
store.register_early_pass(|| Box::new(suspicious_doc_comments::SuspiciousDocComments));
|
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(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`
|
// add lints here, do not remove this comment, it's used in `new_lint`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
#![warn(clippy::default_constructed_unit_struct)]
|
#![warn(clippy::default_constructed_unit_structs)]
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
|
@ -1,25 +1,25 @@
|
||||||
error: use of `default` to create a unit struct
|
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(),
|
LL | inner: PhantomData::default(),
|
||||||
| ^^^^^^^^^^^ help: remove this call to `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
|
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();
|
LL | let _ = PhantomData::<usize>::default();
|
||||||
| ^^^^^^^^^^^ help: remove this call to `default`
|
| ^^^^^^^^^^^ help: remove this call to `default`
|
||||||
|
|
||||||
error: use of `default` to create a unit struct
|
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();
|
LL | let _: PhantomData<i32> = PhantomData::default();
|
||||||
| ^^^^^^^^^^^ help: remove this call to `default`
|
| ^^^^^^^^^^^ help: remove this call to `default`
|
||||||
|
|
||||||
error: use of `default` to create a unit struct
|
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();
|
LL | let _ = UnitStruct::default();
|
||||||
| ^^^^^^^^^^^ help: remove this call to `default`
|
| ^^^^^^^^^^^ help: remove this call to `default`
|
Loading…
Reference in a new issue