diff --git a/CHANGELOG.md b/CHANGELOG.md index 180e7d8be..5b6b12c62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4188,6 +4188,7 @@ Released 2018-09-13 [`misaligned_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#misaligned_transmute [`mismatched_target_os`]: https://rust-lang.github.io/rust-clippy/master/index.html#mismatched_target_os [`mismatching_type_param_order`]: https://rust-lang.github.io/rust-clippy/master/index.html#mismatching_type_param_order +[`misnamed_getters`]: https://rust-lang.github.io/rust-clippy/master/index.html#misnamed_getters [`misrefactored_assign_op`]: https://rust-lang.github.io/rust-clippy/master/index.html#misrefactored_assign_op [`missing_const_for_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn [`missing_docs_in_private_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_docs_in_private_items @@ -4198,7 +4199,6 @@ Released 2018-09-13 [`missing_safety_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc [`missing_spin_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_spin_loop [`missing_trait_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#missing_trait_methods -[`missnamed_getters`]: https://rust-lang.github.io/rust-clippy/master/index.html#missnamed_getters [`mistyped_literal_suffixes`]: https://rust-lang.github.io/rust-clippy/master/index.html#mistyped_literal_suffixes [`mixed_case_hex_literals`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_case_hex_literals [`mixed_read_write_in_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#mixed_read_write_in_expression diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index bccf84259..eb3210946 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -177,7 +177,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::from_raw_with_void_ptr::FROM_RAW_WITH_VOID_PTR_INFO, crate::from_str_radix_10::FROM_STR_RADIX_10_INFO, crate::functions::DOUBLE_MUST_USE_INFO, - crate::functions::MISSNAMED_GETTERS_INFO, + crate::functions::MISNAMED_GETTERS_INFO, crate::functions::MUST_USE_CANDIDATE_INFO, crate::functions::MUST_USE_UNIT_INFO, crate::functions::NOT_UNSAFE_PTR_ARG_DEREF_INFO, diff --git a/clippy_lints/src/functions/missnamed_getters.rs b/clippy_lints/src/functions/misnamed_getters.rs similarity index 98% rename from clippy_lints/src/functions/missnamed_getters.rs rename to clippy_lints/src/functions/misnamed_getters.rs index 3d78679b5..3859c7a62 100644 --- a/clippy_lints/src/functions/missnamed_getters.rs +++ b/clippy_lints/src/functions/misnamed_getters.rs @@ -6,7 +6,7 @@ use rustc_lint::LateContext; use rustc_middle::ty; use rustc_span::Span; -use super::MISSNAMED_GETTERS; +use super::MISNAMED_GETTERS; pub fn check_fn( cx: &LateContext<'_>, @@ -111,7 +111,7 @@ pub fn check_fn( let sugg = format!("{snippet}{name}"); span_lint_and_then( cx, - MISSNAMED_GETTERS, + MISNAMED_GETTERS, span, "getter function appears to return the wrong field", |diag| { diff --git a/clippy_lints/src/functions/mod.rs b/clippy_lints/src/functions/mod.rs index e4181a164..3478fdd86 100644 --- a/clippy_lints/src/functions/mod.rs +++ b/clippy_lints/src/functions/mod.rs @@ -1,4 +1,4 @@ -mod missnamed_getters; +mod misnamed_getters; mod must_use; mod not_unsafe_ptr_arg_deref; mod result; @@ -297,7 +297,7 @@ declare_clippy_lint! { /// } /// ``` #[clippy::version = "1.66.0"] - pub MISSNAMED_GETTERS, + pub MISNAMED_GETTERS, suspicious, "getter method returning the wrong field" } @@ -328,7 +328,7 @@ impl_lint_pass!(Functions => [ MUST_USE_CANDIDATE, RESULT_UNIT_ERR, RESULT_LARGE_ERR, - MISSNAMED_GETTERS, + MISNAMED_GETTERS, ]); impl<'tcx> LateLintPass<'tcx> for Functions { @@ -344,7 +344,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions { too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold); too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold); not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, hir_id); - missnamed_getters::check_fn(cx, kind, decl, body, span, hir_id); + misnamed_getters::check_fn(cx, kind, decl, body, span, hir_id); } fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) { diff --git a/tests/ui/missnamed_getters.rs b/tests/ui/misnamed_getters.rs similarity index 96% rename from tests/ui/missnamed_getters.rs rename to tests/ui/misnamed_getters.rs index f9c2351f8..7d490f4b1 100644 --- a/tests/ui/missnamed_getters.rs +++ b/tests/ui/misnamed_getters.rs @@ -1,5 +1,5 @@ #![allow(unused)] -#![warn(clippy::missnamed_getters)] +#![warn(clippy::misnamed_getters)] struct A { a: u8, diff --git a/tests/ui/missnamed_getters.stderr b/tests/ui/misnamed_getters.stderr similarity index 83% rename from tests/ui/missnamed_getters.stderr rename to tests/ui/misnamed_getters.stderr index 2e3d9df34..f4a059ab9 100644 --- a/tests/ui/missnamed_getters.stderr +++ b/tests/ui/misnamed_getters.stderr @@ -1,5 +1,5 @@ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:11:5 + --> $DIR/misnamed_getters.rs:11:5 | LL | / fn a(&self) -> &u8 { LL | | &self.b @@ -7,10 +7,10 @@ LL | | &self.b LL | | } | |_____^ | - = note: `-D clippy::missnamed-getters` implied by `-D warnings` + = note: `-D clippy::misnamed-getters` implied by `-D warnings` error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:14:5 + --> $DIR/misnamed_getters.rs:14:5 | LL | / fn a_mut(&mut self) -> &mut u8 { LL | | &mut self.b @@ -19,7 +19,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:18:5 + --> $DIR/misnamed_getters.rs:18:5 | LL | / fn b(self) -> u8 { LL | | self.a @@ -28,7 +28,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:22:5 + --> $DIR/misnamed_getters.rs:22:5 | LL | / fn b_mut(&mut self) -> &mut u8 { LL | | &mut self.a @@ -37,7 +37,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:26:5 + --> $DIR/misnamed_getters.rs:26:5 | LL | / fn c(&self) -> &u8 { LL | | &self.b @@ -46,7 +46,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:30:5 + --> $DIR/misnamed_getters.rs:30:5 | LL | / fn c_mut(&mut self) -> &mut u8 { LL | | &mut self.a @@ -55,7 +55,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:41:5 + --> $DIR/misnamed_getters.rs:41:5 | LL | / unsafe fn a(&self) -> &u8 { LL | | &self.b @@ -64,7 +64,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:44:5 + --> $DIR/misnamed_getters.rs:44:5 | LL | / unsafe fn a_mut(&mut self) -> &mut u8 { LL | | &mut self.b @@ -73,7 +73,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:48:5 + --> $DIR/misnamed_getters.rs:48:5 | LL | / unsafe fn b(self) -> u8 { LL | | self.a @@ -82,7 +82,7 @@ LL | | } | |_____^ error: getter function appears to return the wrong field - --> $DIR/missnamed_getters.rs:52:5 + --> $DIR/misnamed_getters.rs:52:5 | LL | / unsafe fn b_mut(&mut self) -> &mut u8 { LL | | &mut self.a