]> git.lizzy.rs Git - rust.git/commitdiff
Fix badly mangled lint message for neg-cmp-op-on-partial-ord
authorGeorg Brandl <georg@python.org>
Fri, 29 Jun 2018 14:55:26 +0000 (16:55 +0200)
committerGeorg Brandl <georg@python.org>
Fri, 29 Jun 2018 14:55:31 +0000 (16:55 +0200)
clippy_lints/src/neg_cmp_op_on_partial_ord.rs
tests/ui/booleans.rs
tests/ui/neg_cmp_op_on_partial_ord.rs
tests/ui/neg_cmp_op_on_partial_ord.stderr

index 013bab69d798ba0657ea347639e7d6a6dc6c2a97..cae88263111f4a68e15c49711b6749911e648af1 100644 (file)
@@ -4,20 +4,20 @@
 use crate::utils::{self, paths, span_lint, in_external_macro};
 
 /// **What it does:**
-/// Checks for the usage of negated comparision operators on types which only implement
+/// Checks for the usage of negated comparison operators on types which only implement
 /// `PartialOrd` (e.g. `f64`).
 ///
 /// **Why is this bad?**
 /// These operators make it easy to forget that the underlying types actually allow not only three
-/// potential Orderings (Less, Equal, Greater) but also a forth one (Uncomparable). Escpeccially if
-/// the operator based comparision result is negated it is easy to miss that fact.
+/// potential Orderings (Less, Equal, Greater) but also a forth one (Uncomparable). This is
+/// especially easy to miss if the operator based comparison result is negated.
 ///
 /// **Known problems:** None.
 ///
 /// **Example:**
 ///
 /// ```rust
-/// use core::cmp::Ordering;
+/// use std::cmp::Ordering;
 /// 
 /// // Bad
 /// let a = 1.0;
@@ -37,7 +37,7 @@
 declare_clippy_lint! {
     pub NEG_CMP_OP_ON_PARTIAL_ORD,
     complexity,
-    "The use of negated comparision operators on partially orded types may produce confusing code."
+    "The use of negated comparison operators on partially ordered types may produce confusing code."
 }
 
 pub struct NoNegCompOpForPartialOrd;
@@ -83,10 +83,10 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
                         cx,
                         NEG_CMP_OP_ON_PARTIAL_ORD,
                         expr.span,
-                        "The use of negated comparision operators on partially orded \
+                        "The use of negated comparison operators on partially ordered \
                         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."
+                        consider using the `partial_cmp` method instead, to make it \
+                        clear that the two values could be incomparable."
                     )
                 }
             }
index 9daf15d378ccf32ce9ac8fe3bf13d60323a616ce..fc16c12af28ac62beb0485b3e790df07559e4d43 100644 (file)
@@ -116,7 +116,7 @@ fn warn_for_built_in_methods_with_negation() {
 }
 
 #[allow(neg_cmp_op_on_partial_ord)]
-fn dont_warn_for_negated_partial_ord_comparision() {
+fn dont_warn_for_negated_partial_ord_comparison() {
     let a: f64 = unimplemented!();
     let b: f64 = unimplemented!();
     let _ = !(a < b);
index 483972bb41b3ba982128898f497b5db55725b3bc..e739908bc282f2039fd962e9720dc65771e12d02 100644 (file)
@@ -59,9 +59,9 @@ fn main() {
 
     // Issue 2856: False positive on assert!()
     //
-    // The macro always negates the result of the given comparision in its
+    // The macro always negates the result of the given comparison in its
     // internal check which automatically triggered the lint. As it's an
-    // external macro there was no chance to do anything about it which lead
+    // external macro there was no chance to do anything about it which led
     // to a whitelisting of all external macros.
     assert!(a_value < another_value);
 }
index 5067ece8705045e83c368961ced03e58be53772e..ccd3056110090db4dcaefd3919e97f86e74ef608 100644 (file)
@@ -1,4 +1,4 @@
-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.
+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.
   --> $DIR/neg_cmp_op_on_partial_ord.rs:17:21
    |
 17 |     let _not_less = !(a_value < another_value);
@@ -6,19 +6,19 @@ error: The use of negated comparision operators on partially orded types produce
    |
    = note: `-D neg-cmp-op-on-partial-ord` implied by `-D warnings`
 
-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.
+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.
   --> $DIR/neg_cmp_op_on_partial_ord.rs:20:30
    |
 20 |     let _not_less_or_equal = !(a_value <= another_value);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-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.
+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.
   --> $DIR/neg_cmp_op_on_partial_ord.rs:23:24
    |
 23 |     let _not_greater = !(a_value > another_value);
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-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.
+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.
   --> $DIR/neg_cmp_op_on_partial_ord.rs:26:33
    |
 26 |     let _not_greater_or_equal = !(a_value >= another_value);