Skip to content

Commit 77d37af

Browse files
committed
rename to manual_partial_ord_and_ord_impl
1 parent 163a6ec commit 77d37af

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4917,7 +4917,7 @@ Released 2018-09-13
49174917
[`manual_next_back`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
49184918
[`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
49194919
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
4920-
[`manual_partial_ord_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_partial_ord_impl
4920+
[`manual_partial_ord_and_ord_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_partial_ord_and_ord_impl
49214921
[`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
49224922
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
49234923
[`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
273273
crate::manual_let_else::MANUAL_LET_ELSE_INFO,
274274
crate::manual_main_separator_str::MANUAL_MAIN_SEPARATOR_STR_INFO,
275275
crate::manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE_INFO,
276-
crate::manual_partial_ord_impl::MANUAL_PARTIAL_ORD_IMPL_INFO,
276+
crate::manual_partial_ord_and_ord_impl::MANUAL_PARTIAL_ORD_AND_ORD_IMPL_INFO,
277277
crate::manual_rem_euclid::MANUAL_REM_EUCLID_INFO,
278278
crate::manual_retain::MANUAL_RETAIN_INFO,
279279
crate::manual_slice_size_calculation::MANUAL_SLICE_SIZE_CALCULATION_INFO,

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ mod manual_is_ascii_check;
184184
mod manual_let_else;
185185
mod manual_main_separator_str;
186186
mod manual_non_exhaustive;
187-
mod manual_partial_ord_impl;
187+
mod manual_partial_ord_and_ord_impl;
188188
mod manual_rem_euclid;
189189
mod manual_retain;
190190
mod manual_slice_size_calculation;
@@ -1014,7 +1014,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10141014
store.register_late_pass(|_| Box::new(missing_fields_in_debug::MissingFieldsInDebug));
10151015
store.register_late_pass(|_| Box::new(endian_bytes::EndianBytes));
10161016
store.register_late_pass(|_| {
1017-
Box::new(manual_partial_ord_impl::ManualPartialOrdImpl {
1017+
Box::new(manual_partial_ord_and_ord_impl::ManualPartialOrdAndOrdImpl {
10181018
ord_def_id: std::cell::OnceCell::new(),
10191019
})
10201020
});

clippy_lints/src/manual_partial_ord_impl.rs renamed to clippy_lints/src/manual_partial_ord_and_ord_impl.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare_clippy_lint! {
1616
///
1717
/// ### Why is this bad?
1818
/// If both `PartialOrd` and `Ord` are implemented, `PartialOrd` will wrap the returned value of
19-
/// `Ord::cmp` in `Some`. Not doing this may silently introduce an error.
19+
/// `Ord::cmp` in `Some`. Not doing this may silently introduce an error upon refactoring.
2020
///
2121
/// ### Example
2222
/// ```rust
@@ -53,18 +53,18 @@ declare_clippy_lint! {
5353
/// }
5454
/// ```
5555
#[clippy::version = "1.71.0"]
56-
pub MANUAL_PARTIAL_ORD_IMPL,
57-
nursery,
56+
pub MANUAL_PARTIAL_ORD_AND_ORD_IMPL,
57+
correctness,
5858
"default lint description"
5959
}
60-
impl_lint_pass!(ManualPartialOrdImpl => [MANUAL_PARTIAL_ORD_IMPL]);
60+
impl_lint_pass!(ManualPartialOrdAndOrdImpl => [MANUAL_PARTIAL_ORD_AND_ORD_IMPL]);
6161

6262
#[derive(Clone)]
63-
pub struct ManualPartialOrdImpl {
63+
pub struct ManualPartialOrdAndOrdImpl {
6464
pub ord_def_id: OnceCell<DefId>,
6565
}
6666

67-
impl LateLintPass<'_> for ManualPartialOrdImpl {
67+
impl LateLintPass<'_> for ManualPartialOrdAndOrdImpl {
6868
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
6969
if_chain! {
7070
if let ItemKind::Impl(imp) = &item.kind;
@@ -77,7 +77,7 @@ impl LateLintPass<'_> for ManualPartialOrdImpl {
7777
}
7878
}
7979

80-
fn lint_impl_body(conf: &mut ManualPartialOrdImpl, cx: &LateContext<'_>, imp: &Impl<'_>, item: &Item<'_>) {
80+
fn lint_impl_body(conf: &mut ManualPartialOrdAndOrdImpl, cx: &LateContext<'_>, imp: &Impl<'_>, item: &Item<'_>) {
8181
for imp_item in imp.items {
8282
if_chain! {
8383
if imp_item.ident.name == sym!(partial_cmp);
@@ -102,7 +102,7 @@ fn lint_impl_body(conf: &mut ManualPartialOrdImpl, cx: &LateContext<'_>, imp: &I
102102
else {
103103
span_lint_and_then(
104104
cx,
105-
MANUAL_PARTIAL_ORD_IMPL,
105+
MANUAL_PARTIAL_ORD_AND_ORD_IMPL,
106106
item.span,
107107
"manual implementation of `PartialOrd` when `Ord` is already implemented",
108108
|diag| {
File renamed without changes.

tests/ui/manual_partial_ord_impl.stderr renamed to tests/ui/manual_partial_ord_and_ord_impl.stderr

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
error: unknown lint: `clippy::manual_partial_ord_impl`
2+
--> $DIR/manual_partial_ord_and_ord_impl.rs:2:9
3+
|
4+
LL | #![warn(clippy::manual_partial_ord_impl)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::manual_partial_ord_and_ord_impl`
6+
|
7+
= note: `-D unknown-lints` implied by `-D warnings`
8+
19
error: manual implementation of `PartialOrd` when `Ord` is already implemented
2-
--> $DIR/manual_partial_ord_impl.rs:18:1
10+
--> $DIR/manual_partial_ord_and_ord_impl.rs:18:1
311
|
412
LL | / impl PartialOrd for A {
513
LL | | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
@@ -10,10 +18,10 @@ LL | || }
1018
LL | | }
1119
| |__^
1220
|
13-
= note: `-D clippy::manual-partial-ord-impl` implied by `-D warnings`
21+
= note: `#[deny(clippy::manual_partial_ord_and_ord_impl)]` on by default
1422

1523
error: manual implementation of `PartialOrd` when `Ord` is already implemented
16-
--> $DIR/manual_partial_ord_impl.rs:52:1
24+
--> $DIR/manual_partial_ord_and_ord_impl.rs:52:1
1725
|
1826
LL | / impl PartialOrd for C {
1927
LL | | fn partial_cmp(&self, _: &Self) -> Option<Ordering> {
@@ -24,5 +32,5 @@ LL | | }
2432
|
2533
= help: return the value of `self.cmp` wrapped in `Some` instead
2634

27-
error: aborting due to 2 previous errors
35+
error: aborting due to 3 previous errors
2836

0 commit comments

Comments
 (0)