Skip to content

Commit

Permalink
Rename lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nhamovitz committed Oct 19, 2021
1 parent 60da4c9 commit 0f9f591
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3021,7 +3021,7 @@ Released 2018-09-13
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
[`too_many_lines`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
[`toplevel_ref_arg`]: https://rust-lang.github.io/rust-clippy/master/index.html#toplevel_ref_arg
[`trailing_zero_sized_array_without_repr`]: https://rust-lang.github.io/rust-clippy/master/index.html#trailing_zero_sized_array_without_repr
[`trailing_empty_array`]: https://rust-lang.github.io/rust-clippy/master/index.html#trailing_empty_array
[`trait_duplication_in_bounds`]: https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds
[`transmute_bytes_to_str`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_bytes_to_str
[`transmute_float_to_int`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_float_to_int
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.register_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ store.register_lints(&[
temporary_assignment::TEMPORARY_ASSIGNMENT,
to_digit_is_some::TO_DIGIT_IS_SOME,
to_string_in_display::TO_STRING_IN_DISPLAY,
trailing_zero_sized_array_without_repr::TRAILING_ZERO_SIZED_ARRAY_WITHOUT_REPR,
trailing_empty_array::TRAILING_EMPTY_ARRAY,
trait_bounds::TRAIT_DUPLICATION_IN_BOUNDS,
trait_bounds::TYPE_REPETITION_IN_BOUNDS,
transmute::CROSSPOINTER_TRANSMUTE,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.register_nursery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
LintId::of(regex::TRIVIAL_REGEX),
LintId::of(strings::STRING_LIT_AS_BYTES),
LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
LintId::of(trailing_zero_sized_array_without_repr::TRAILING_ZERO_SIZED_ARRAY_WITHOUT_REPR),
LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY),
LintId::of(transmute::USELESS_TRANSMUTE),
LintId::of(use_self::USE_SELF),
])
4 changes: 2 additions & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ mod tabs_in_doc_comments;
mod temporary_assignment;
mod to_digit_is_some;
mod to_string_in_display;
mod trailing_zero_sized_array_without_repr;
mod trailing_empty_array;
mod trait_bounds;
mod transmute;
mod transmuting_null;
Expand Down Expand Up @@ -778,7 +778,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(move || Box::new(undocumented_unsafe_blocks::UndocumentedUnsafeBlocks::default()));
store.register_late_pass(|| Box::new(match_str_case_mismatch::MatchStrCaseMismatch));
store.register_late_pass(move || Box::new(format_args::FormatArgs));
store.register_late_pass(|| Box::new(trailing_zero_sized_array_without_repr::TrailingZeroSizedArrayWithoutRepr));
store.register_late_pass(|| Box::new(trailing_empty_array::TrailingEmptyArray));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ declare_clippy_lint! {
/// last: [u32; 0],
/// }
/// ```
pub TRAILING_ZERO_SIZED_ARRAY_WITHOUT_REPR,
pub TRAILING_EMPTY_ARRAY,
nursery,
"struct with a trailing zero-sized array but without `#[repr(C)]` or another `repr` attribute"
}
declare_lint_pass!(TrailingZeroSizedArrayWithoutRepr => [TRAILING_ZERO_SIZED_ARRAY_WITHOUT_REPR]);
declare_lint_pass!(TrailingEmptyArray => [TRAILING_EMPTY_ARRAY]);

impl<'tcx> LateLintPass<'tcx> for TrailingZeroSizedArrayWithoutRepr {
impl<'tcx> LateLintPass<'tcx> for TrailingEmptyArray {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
if is_struct_with_trailing_zero_sized_array(cx, item) && !has_repr_attr(cx, item.hir_id()) {
span_lint_and_help(
cx,
TRAILING_ZERO_SIZED_ARRAY_WITHOUT_REPR,
TRAILING_EMPTY_ARRAY,
item.span,
"trailing zero-sized array in a struct which is not marked with a `repr` attribute",
None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![warn(clippy::trailing_zero_sized_array_without_repr)]
#![warn(clippy::trailing_empty_array)]
#![feature(const_generics_defaults)]

// Do lint:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:6:1
--> $DIR/trailing_empty_array.rs:6:1
|
LL | / struct RarelyUseful {
LL | | field: i32,
LL | | last: [usize; 0],
LL | | }
| |_^
|
= note: `-D clippy::trailing-zero-sized-array-without-repr` implied by `-D warnings`
= note: `-D clippy::trailing-empty-array` implied by `-D warnings`
= help: consider annotating `RarelyUseful` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:11:1
--> $DIR/trailing_empty_array.rs:11:1
|
LL | / struct OnlyField {
LL | | first_and_last: [usize; 0],
Expand All @@ -21,7 +21,7 @@ LL | | }
= help: consider annotating `OnlyField` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:15:1
--> $DIR/trailing_empty_array.rs:15:1
|
LL | / struct GenericArrayType<T> {
LL | | field: i32,
Expand All @@ -32,7 +32,7 @@ LL | | }
= help: consider annotating `GenericArrayType` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:21:1
--> $DIR/trailing_empty_array.rs:21:1
|
LL | / struct OnlyAnotherAttribute {
LL | | field: i32,
Expand All @@ -43,7 +43,7 @@ LL | | }
= help: consider annotating `OnlyAnotherAttribute` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:29:1
--> $DIR/trailing_empty_array.rs:27:1
|
LL | / struct OnlyADeriveAttribute {
LL | | field: i32,
Expand All @@ -54,7 +54,7 @@ LL | | }
= help: consider annotating `OnlyADeriveAttribute` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:35:1
--> $DIR/trailing_empty_array.rs:33:1
|
LL | / struct ZeroSizedWithConst {
LL | | field: i32,
Expand All @@ -65,7 +65,7 @@ LL | | }
= help: consider annotating `ZeroSizedWithConst` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:44:1
--> $DIR/trailing_empty_array.rs:42:1
|
LL | / struct ZeroSizedWithConstFunction {
LL | | field: i32,
Expand All @@ -76,7 +76,7 @@ LL | | }
= help: consider annotating `ZeroSizedWithConstFunction` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:52:1
--> $DIR/trailing_empty_array.rs:50:1
|
LL | / struct ZeroSizedWithConstFunction2 {
LL | | field: i32,
Expand All @@ -87,23 +87,23 @@ LL | | }
= help: consider annotating `ZeroSizedWithConstFunction2` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:57:1
--> $DIR/trailing_empty_array.rs:55:1
|
LL | struct ZeroSizedArrayWrapper([usize; 0]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider annotating `ZeroSizedArrayWrapper` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:59:1
--> $DIR/trailing_empty_array.rs:57:1
|
LL | struct TupleStruct(i32, [usize; 0]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider annotating `TupleStruct` with `#[repr(C)]` or another `repr` attribute

error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
--> $DIR/trailing_zero_sized_array_without_repr.rs:61:1
--> $DIR/trailing_empty_array.rs:59:1
|
LL | / struct LotsOfFields {
LL | | f1: u32,
Expand Down

0 comments on commit 0f9f591

Please sign in to comment.