Skip to content

Commit 949f0d9

Browse files
committed
Fix badly mangled lint message for neg-cmp-op-on-partial-ord
1 parent b4b6e65 commit 949f0d9

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

clippy_lints/src/neg_cmp_op_on_partial_ord.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ use rustc::lint::*;
44
use crate::utils::{self, paths, span_lint, in_external_macro};
55

66
/// **What it does:**
7-
/// Checks for the usage of negated comparision operators on types which only implement
7+
/// Checks for the usage of negated comparison operators on types which only implement
88
/// `PartialOrd` (e.g. `f64`).
99
///
1010
/// **Why is this bad?**
1111
/// These operators make it easy to forget that the underlying types actually allow not only three
12-
/// potential Orderings (Less, Equal, Greater) but also a forth one (Uncomparable). Escpeccially if
13-
/// the operator based comparision result is negated it is easy to miss that fact.
12+
/// potential Orderings (Less, Equal, Greater) but also a forth one (Uncomparable). This is
13+
/// especially easy to miss if the operator based comparison result is negated.
1414
///
1515
/// **Known problems:** None.
1616
///
1717
/// **Example:**
1818
///
1919
/// ```rust
20-
/// use core::cmp::Ordering;
20+
/// use std::cmp::Ordering;
2121
///
2222
/// // Bad
2323
/// let a = 1.0;
@@ -37,7 +37,7 @@ use crate::utils::{self, paths, span_lint, in_external_macro};
3737
declare_clippy_lint! {
3838
pub NEG_CMP_OP_ON_PARTIAL_ORD,
3939
complexity,
40-
"The use of negated comparision operators on partially orded types may produce confusing code."
40+
"The use of negated comparison operators on partially ordered types may produce confusing code."
4141
}
4242

4343
pub struct NoNegCompOpForPartialOrd;
@@ -83,10 +83,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NoNegCompOpForPartialOrd {
8383
cx,
8484
NEG_CMP_OP_ON_PARTIAL_ORD,
8585
expr.span,
86-
"The use of negated comparision operators on partially orded \
86+
"The use of negated comparison operators on partially ordered \
8787
types produces code that is hard to read and refactor. Please \
88-
consider to use the `partial_cmp` instead, to make it clear \
89-
that the two values could be incomparable."
88+
consider using the `partial_cmp` method instead, to make it \
89+
clear that the two values could be incomparable."
9090
)
9191
}
9292
}

tests/ui/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn warn_for_built_in_methods_with_negation() {
116116
}
117117

118118
#[allow(neg_cmp_op_on_partial_ord)]
119-
fn dont_warn_for_negated_partial_ord_comparision() {
119+
fn dont_warn_for_negated_partial_ord_comparison() {
120120
let a: f64 = unimplemented!();
121121
let b: f64 = unimplemented!();
122122
let _ = !(a < b);

tests/ui/neg_cmp_op_on_partial_ord.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ fn main() {
5959

6060
// Issue 2856: False positive on assert!()
6161
//
62-
// The macro always negates the result of the given comparision in its
62+
// The macro always negates the result of the given comparison in its
6363
// internal check which automatically triggered the lint. As it's an
64-
// external macro there was no chance to do anything about it which lead
64+
// external macro there was no chance to do anything about it which led
6565
// to a whitelisting of all external macros.
6666
assert!(a_value < another_value);
6767
}

tests/ui/neg_cmp_op_on_partial_ord.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
1+
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
22
--> $DIR/neg_cmp_op_on_partial_ord.rs:17:21
33
|
44
17 | let _not_less = !(a_value < another_value);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D neg-cmp-op-on-partial-ord` implied by `-D warnings`
88

9-
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
9+
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
1010
--> $DIR/neg_cmp_op_on_partial_ord.rs:20:30
1111
|
1212
20 | let _not_less_or_equal = !(a_value <= another_value);
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

15-
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
15+
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
1616
--> $DIR/neg_cmp_op_on_partial_ord.rs:23:24
1717
|
1818
23 | let _not_greater = !(a_value > another_value);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

21-
error: The use of negated comparision operators on partially orded types produces code that is hard to read and refactor. Please consider to use the `partial_cmp` instead, to make it clear that the two values could be incomparable.
21+
error: The use of negated comparison operators on partially ordered types produces code that is hard to read and refactor. Please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable.
2222
--> $DIR/neg_cmp_op_on_partial_ord.rs:26:33
2323
|
2424
26 | let _not_greater_or_equal = !(a_value >= another_value);

0 commit comments

Comments
 (0)