Auto merge of #5893 - matthiaskrgr:lint_msg, r=yaahc
fix remaining lint messages r? @yaahc changelog: make remaining lint messages adhere to rustc dev guide lint message convention.
This commit is contained in:
commit
c73cf9f387
@ -56,7 +56,7 @@ impl<'tcx> LateLintPass<'tcx> for DurationSubsec {
|
||||
cx,
|
||||
DURATION_SUBSEC,
|
||||
expr.span,
|
||||
&format!("Calling `{}()` is more concise than this calculation", suggested_fn),
|
||||
&format!("calling `{}()` is more concise than this calculation", suggested_fn),
|
||||
"try",
|
||||
format!(
|
||||
"{}.{}()",
|
||||
|
@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
|
||||
cx,
|
||||
ENUM_CLIKE_UNPORTABLE_VARIANT,
|
||||
var.span,
|
||||
"Clike enum variant discriminant is not portable to 32-bit targets",
|
||||
"C-like enum variant discriminant is not portable to 32-bit targets",
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@ -183,10 +183,10 @@ fn check_variant(
|
||||
&& name.chars().nth(item_name_chars).map_or(false, |c| !c.is_lowercase())
|
||||
&& name.chars().nth(item_name_chars + 1).map_or(false, |c| !c.is_numeric())
|
||||
{
|
||||
span_lint(cx, lint, var.span, "Variant name starts with the enum's name");
|
||||
span_lint(cx, lint, var.span, "variant name starts with the enum's name");
|
||||
}
|
||||
if partial_rmatch(item_name, &name) == item_name_chars {
|
||||
span_lint(cx, lint, var.span, "Variant name ends with the enum's name");
|
||||
span_lint(cx, lint, var.span, "variant name ends with the enum's name");
|
||||
}
|
||||
}
|
||||
let first = &def.variants[0].ident.name.as_str();
|
||||
@ -227,7 +227,7 @@ fn check_variant(
|
||||
cx,
|
||||
lint,
|
||||
span,
|
||||
&format!("All variants have the same {}fix: `{}`", what, value),
|
||||
&format!("all variants have the same {}fix: `{}`", what, value),
|
||||
None,
|
||||
&format!(
|
||||
"remove the {}fixes and use full paths to \
|
||||
|
@ -61,8 +61,8 @@ impl<'tcx> LateLintPass<'tcx> for OkIfLet {
|
||||
cx,
|
||||
IF_LET_SOME_RESULT,
|
||||
expr.span.with_hi(op.span.hi()),
|
||||
"Matching on `Some` with `ok()` is redundant",
|
||||
&format!("Consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
|
||||
"matching on `Some` with `ok()` is redundant",
|
||||
&format!("consider matching on `Ok({})` and removing the call to `ok` instead", some_expr_string),
|
||||
sugg,
|
||||
applicability,
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ impl EarlyLintPass for IfNotElse {
|
||||
cx,
|
||||
IF_NOT_ELSE,
|
||||
item.span,
|
||||
"Unnecessary boolean `not` operation",
|
||||
"unnecessary boolean `not` operation",
|
||||
None,
|
||||
"remove the `!` and swap the blocks of the `if`/`else`",
|
||||
);
|
||||
@ -70,7 +70,7 @@ impl EarlyLintPass for IfNotElse {
|
||||
cx,
|
||||
IF_NOT_ELSE,
|
||||
item.span,
|
||||
"Unnecessary `!=` operation",
|
||||
"unnecessary `!=` operation",
|
||||
None,
|
||||
"change to `==` and swap the blocks of the `if`/`else`",
|
||||
);
|
||||
|
@ -158,9 +158,9 @@ fn print_lint_and_sugg(cx: &LateContext<'_>, var_name: &str, expr: &Expr<'_>) {
|
||||
cx,
|
||||
IMPLICIT_SATURATING_SUB,
|
||||
expr.span,
|
||||
"Implicitly performing saturating subtraction",
|
||||
"implicitly performing saturating subtraction",
|
||||
"try",
|
||||
format!("{} = {}.saturating_sub({});", var_name, var_name, 1.to_string()),
|
||||
format!("{} = {}.saturating_sub({});", var_name, var_name, '1'),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
||||
cx,
|
||||
MULTIPLE_INHERENT_IMPL,
|
||||
*additional_span,
|
||||
"Multiple implementations of this structure",
|
||||
"multiple implementations of this structure",
|
||||
|diag| {
|
||||
diag.span_note(*initial_span, "First implementation here");
|
||||
diag.span_note(*initial_span, "first implementation here");
|
||||
},
|
||||
)
|
||||
})
|
||||
|
@ -152,7 +152,7 @@ impl IntPlusOne {
|
||||
cx,
|
||||
INT_PLUS_ONE,
|
||||
block.span,
|
||||
"Unnecessary `>= y + 1` or `x - 1 >=`",
|
||||
"unnecessary `>= y + 1` or `x - 1 >=`",
|
||||
"change it to",
|
||||
recommendation,
|
||||
Applicability::MachineApplicable, // snippet
|
||||
@ -163,8 +163,8 @@ impl IntPlusOne {
|
||||
impl EarlyLintPass for IntPlusOne {
|
||||
fn check_expr(&mut self, cx: &EarlyContext<'_>, item: &Expr) {
|
||||
if let ExprKind::Binary(ref kind, ref lhs, ref rhs) = item.kind {
|
||||
if let Some(ref rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
|
||||
Self::emit_warning(cx, item, rec.clone());
|
||||
if let Some(rec) = Self::check_binop(cx, kind.node, lhs, rhs) {
|
||||
Self::emit_warning(cx, item, rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ fn lint_needless_cloning(cx: &LateContext<'_>, root: Span, receiver: Span) {
|
||||
cx,
|
||||
MAP_CLONE,
|
||||
root.trim_start(receiver).unwrap(),
|
||||
"You are needlessly cloning iterator elements",
|
||||
"Remove the `map` call",
|
||||
"you are needlessly cloning iterator elements",
|
||||
"remove the `map` call",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
@ -125,8 +125,8 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
|
||||
cx,
|
||||
MAP_CLONE,
|
||||
replace,
|
||||
"You are using an explicit closure for copying elements",
|
||||
"Consider calling the dedicated `copied` method",
|
||||
"you are using an explicit closure for copying elements",
|
||||
"consider calling the dedicated `copied` method",
|
||||
format!(
|
||||
"{}.copied()",
|
||||
snippet_with_applicability(cx, root, "..", &mut applicability)
|
||||
@ -138,8 +138,8 @@ fn lint(cx: &LateContext<'_>, replace: Span, root: Span, copied: bool) {
|
||||
cx,
|
||||
MAP_CLONE,
|
||||
replace,
|
||||
"You are using an explicit closure for cloning elements",
|
||||
"Consider calling the dedicated `cloned` method",
|
||||
"you are using an explicit closure for cloning elements",
|
||||
"consider calling the dedicated `cloned` method",
|
||||
format!(
|
||||
"{}.cloned()",
|
||||
snippet_with_applicability(cx, root, "..", &mut applicability)
|
||||
|
@ -2280,7 +2280,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
|
||||
cx,
|
||||
ITER_NEXT_SLICE,
|
||||
expr.span,
|
||||
"Using `.iter().next()` on a Slice without end index.",
|
||||
"using `.iter().next()` on a Slice without end index",
|
||||
"try calling",
|
||||
format!("{}.get({})", snippet_with_applicability(cx, caller_var.span, "..", &mut applicability), start_idx),
|
||||
applicability,
|
||||
@ -2299,7 +2299,7 @@ fn lint_iter_next<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, iter_
|
||||
cx,
|
||||
ITER_NEXT_SLICE,
|
||||
expr.span,
|
||||
"Using `.iter().next()` on an array",
|
||||
"using `.iter().next()` on an array",
|
||||
"try calling",
|
||||
format!(
|
||||
"{}.get(0)",
|
||||
|
@ -72,8 +72,8 @@ impl<'tcx> LateLintPass<'tcx> for Mutex {
|
||||
let mutex_param = subst.type_at(0);
|
||||
if let Some(atomic_name) = get_atomic_name(mutex_param) {
|
||||
let msg = format!(
|
||||
"Consider using an `{}` instead of a `Mutex` here. If you just want the locking \
|
||||
behavior and not the internal type, consider using `Mutex<()>`.",
|
||||
"consider using an `{}` instead of a `Mutex` here; if you just want the locking \
|
||||
behavior and not the internal type, consider using `Mutex<()>`",
|
||||
atomic_name
|
||||
);
|
||||
match mutex_param.kind {
|
||||
|
@ -111,9 +111,9 @@ impl LateLintPass<'_> for StableSortPrimitive {
|
||||
STABLE_SORT_PRIMITIVE,
|
||||
expr.span,
|
||||
format!(
|
||||
"Use {} instead of {}",
|
||||
detection.method.unstable_name(),
|
||||
detection.method.stable_name()
|
||||
"used {} instead of {}",
|
||||
detection.method.stable_name(),
|
||||
detection.method.unstable_name()
|
||||
)
|
||||
.as_str(),
|
||||
"try",
|
||||
|
@ -50,7 +50,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
pub USE_SELF,
|
||||
nursery,
|
||||
"Unnecessary structure name repetition whereas `Self` is applicable"
|
||||
"unnecessary structure name repetition whereas `Self` is applicable"
|
||||
}
|
||||
|
||||
declare_lint_pass!(UseSelf => [USE_SELF]);
|
||||
|
@ -2498,7 +2498,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
|
||||
Lint {
|
||||
name: "use_self",
|
||||
group: "nursery",
|
||||
desc: "Unnecessary structure name repetition whereas `Self` is applicable",
|
||||
desc: "unnecessary structure name repetition whereas `Self` is applicable",
|
||||
deprecation: None,
|
||||
module: "use_self",
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Calling `subsec_millis()` is more concise than this calculation
|
||||
error: calling `subsec_millis()` is more concise than this calculation
|
||||
--> $DIR/duration_subsec.rs:10:24
|
||||
|
|
||||
LL | let bad_millis_1 = dur.subsec_micros() / 1_000;
|
||||
@ -6,25 +6,25 @@ LL | let bad_millis_1 = dur.subsec_micros() / 1_000;
|
||||
|
|
||||
= note: `-D clippy::duration-subsec` implied by `-D warnings`
|
||||
|
||||
error: Calling `subsec_millis()` is more concise than this calculation
|
||||
error: calling `subsec_millis()` is more concise than this calculation
|
||||
--> $DIR/duration_subsec.rs:11:24
|
||||
|
|
||||
LL | let bad_millis_2 = dur.subsec_nanos() / 1_000_000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_millis()`
|
||||
|
||||
error: Calling `subsec_micros()` is more concise than this calculation
|
||||
error: calling `subsec_micros()` is more concise than this calculation
|
||||
--> $DIR/duration_subsec.rs:16:22
|
||||
|
|
||||
LL | let bad_micros = dur.subsec_nanos() / 1_000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `dur.subsec_micros()`
|
||||
|
||||
error: Calling `subsec_micros()` is more concise than this calculation
|
||||
error: calling `subsec_micros()` is more concise than this calculation
|
||||
--> $DIR/duration_subsec.rs:21:13
|
||||
|
|
||||
LL | let _ = (&dur).subsec_nanos() / 1_000;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&dur).subsec_micros()`
|
||||
|
||||
error: Calling `subsec_micros()` is more concise than this calculation
|
||||
error: calling `subsec_micros()` is more concise than this calculation
|
||||
--> $DIR/duration_subsec.rs:25:13
|
||||
|
|
||||
LL | let _ = dur.subsec_nanos() / NANOS_IN_MICRO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:8:5
|
||||
|
|
||||
LL | X = 0x1_0000_0000,
|
||||
@ -6,49 +6,49 @@ LL | X = 0x1_0000_0000,
|
||||
|
|
||||
= note: `-D clippy::enum-clike-unportable-variant` implied by `-D warnings`
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:15:5
|
||||
|
|
||||
LL | X = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:18:5
|
||||
|
|
||||
LL | A = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:25:5
|
||||
|
|
||||
LL | Z = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:26:5
|
||||
|
|
||||
LL | A = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:28:5
|
||||
|
|
||||
LL | C = (i32::MIN as isize) - 1,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:34:5
|
||||
|
|
||||
LL | Z = 0xFFFF_FFFF,
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:35:5
|
||||
|
|
||||
LL | A = 0x1_0000_0000,
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Clike enum variant discriminant is not portable to 32-bit targets
|
||||
error: C-like enum variant discriminant is not portable to 32-bit targets
|
||||
--> $DIR/enum_clike_unportable_variant.rs:40:5
|
||||
|
|
||||
LL | X = <usize as Trait>::Number,
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Variant name ends with the enum's name
|
||||
error: variant name ends with the enum's name
|
||||
--> $DIR/enum_variants.rs:16:5
|
||||
|
|
||||
LL | cFoo,
|
||||
@ -6,25 +6,25 @@ LL | cFoo,
|
||||
|
|
||||
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
error: variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:27:5
|
||||
|
|
||||
LL | FoodGood,
|
||||
| ^^^^^^^^
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
error: variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:28:5
|
||||
|
|
||||
LL | FoodMiddle,
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: Variant name starts with the enum's name
|
||||
error: variant name starts with the enum's name
|
||||
--> $DIR/enum_variants.rs:29:5
|
||||
|
|
||||
LL | FoodBad,
|
||||
| ^^^^^^^
|
||||
|
||||
error: All variants have the same prefix: `Food`
|
||||
error: all variants have the same prefix: `Food`
|
||||
--> $DIR/enum_variants.rs:26:1
|
||||
|
|
||||
LL | / enum Food {
|
||||
@ -36,7 +36,7 @@ LL | | }
|
||||
|
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `CallType`
|
||||
error: all variants have the same prefix: `CallType`
|
||||
--> $DIR/enum_variants.rs:36:1
|
||||
|
|
||||
LL | / enum BadCallType {
|
||||
@ -48,7 +48,7 @@ LL | | }
|
||||
|
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `Constant`
|
||||
error: all variants have the same prefix: `Constant`
|
||||
--> $DIR/enum_variants.rs:48:1
|
||||
|
|
||||
LL | / enum Consts {
|
||||
@ -60,7 +60,7 @@ LL | | }
|
||||
|
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `With`
|
||||
error: all variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:82:1
|
||||
|
|
||||
LL | / enum Seallll {
|
||||
@ -72,7 +72,7 @@ LL | | }
|
||||
|
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `Prefix`
|
||||
error: all variants have the same prefix: `Prefix`
|
||||
--> $DIR/enum_variants.rs:88:1
|
||||
|
|
||||
LL | / enum NonCaps {
|
||||
@ -84,7 +84,7 @@ LL | | }
|
||||
|
|
||||
= help: remove the prefixes and use full paths to the variants instead of glob imports
|
||||
|
||||
error: All variants have the same prefix: `With`
|
||||
error: all variants have the same prefix: `With`
|
||||
--> $DIR/enum_variants.rs:94:1
|
||||
|
|
||||
LL | / pub enum PubSeall {
|
||||
|
@ -1,22 +1,22 @@
|
||||
error: Matching on `Some` with `ok()` is redundant
|
||||
error: matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/if_let_some_result.rs:6:5
|
||||
|
|
||||
LL | if let Some(y) = x.parse().ok() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::if-let-some-result` implied by `-D warnings`
|
||||
help: Consider matching on `Ok(y)` and removing the call to `ok` instead
|
||||
help: consider matching on `Ok(y)` and removing the call to `ok` instead
|
||||
|
|
||||
LL | if let Ok(y) = x.parse() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Matching on `Some` with `ok()` is redundant
|
||||
error: matching on `Some` with `ok()` is redundant
|
||||
--> $DIR/if_let_some_result.rs:24:9
|
||||
|
|
||||
LL | if let Some(y) = x . parse() . ok () {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: Consider matching on `Ok(y)` and removing the call to `ok` instead
|
||||
help: consider matching on `Ok(y)` and removing the call to `ok` instead
|
||||
|
|
||||
LL | if let Ok(y) = x . parse() {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Unnecessary boolean `not` operation
|
||||
error: unnecessary boolean `not` operation
|
||||
--> $DIR/if_not_else.rs:9:5
|
||||
|
|
||||
LL | / if !bla() {
|
||||
@ -11,7 +11,7 @@ LL | | }
|
||||
= note: `-D clippy::if-not-else` implied by `-D warnings`
|
||||
= help: remove the `!` and swap the blocks of the `if`/`else`
|
||||
|
||||
error: Unnecessary `!=` operation
|
||||
error: unnecessary `!=` operation
|
||||
--> $DIR/if_not_else.rs:14:5
|
||||
|
|
||||
LL | / if 4 != 5 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Multiple implementations of this structure
|
||||
error: multiple implementations of this structure
|
||||
--> $DIR/impl.rs:10:1
|
||||
|
|
||||
LL | / impl MyStruct {
|
||||
@ -7,7 +7,7 @@ LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D clippy::multiple-inherent-impl` implied by `-D warnings`
|
||||
note: First implementation here
|
||||
note: first implementation here
|
||||
--> $DIR/impl.rs:6:1
|
||||
|
|
||||
LL | / impl MyStruct {
|
||||
@ -15,7 +15,7 @@ LL | | fn first() {}
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: Multiple implementations of this structure
|
||||
error: multiple implementations of this structure
|
||||
--> $DIR/impl.rs:24:5
|
||||
|
|
||||
LL | / impl super::MyStruct {
|
||||
@ -23,7 +23,7 @@ LL | | fn third() {}
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: First implementation here
|
||||
note: first implementation here
|
||||
--> $DIR/impl.rs:6:1
|
||||
|
|
||||
LL | / impl MyStruct {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:13:5
|
||||
|
|
||||
LL | / if u_8 > 0 {
|
||||
@ -8,7 +8,7 @@ LL | | }
|
||||
|
|
||||
= note: `-D clippy::implicit-saturating-sub` implied by `-D warnings`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:20:13
|
||||
|
|
||||
LL | / if u_8 > 0 {
|
||||
@ -16,7 +16,7 @@ LL | | u_8 -= 1;
|
||||
LL | | }
|
||||
| |_____________^ help: try: `u_8 = u_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:34:5
|
||||
|
|
||||
LL | / if u_16 > 0 {
|
||||
@ -24,7 +24,7 @@ LL | | u_16 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_16 = u_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:44:5
|
||||
|
|
||||
LL | / if u_32 != 0 {
|
||||
@ -32,7 +32,7 @@ LL | | u_32 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_32 = u_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:65:5
|
||||
|
|
||||
LL | / if u_64 > 0 {
|
||||
@ -40,7 +40,7 @@ LL | | u_64 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:70:5
|
||||
|
|
||||
LL | / if 0 < u_64 {
|
||||
@ -48,7 +48,7 @@ LL | | u_64 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:75:5
|
||||
|
|
||||
LL | / if 0 != u_64 {
|
||||
@ -56,7 +56,7 @@ LL | | u_64 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_64 = u_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:96:5
|
||||
|
|
||||
LL | / if u_usize > 0 {
|
||||
@ -64,7 +64,7 @@ LL | | u_usize -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `u_usize = u_usize.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:108:5
|
||||
|
|
||||
LL | / if i_8 > i8::MIN {
|
||||
@ -72,7 +72,7 @@ LL | | i_8 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:113:5
|
||||
|
|
||||
LL | / if i_8 > i8::MIN {
|
||||
@ -80,7 +80,7 @@ LL | | i_8 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:118:5
|
||||
|
|
||||
LL | / if i_8 != i8::MIN {
|
||||
@ -88,7 +88,7 @@ LL | | i_8 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:123:5
|
||||
|
|
||||
LL | / if i_8 != i8::MIN {
|
||||
@ -96,7 +96,7 @@ LL | | i_8 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_8 = i_8.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:133:5
|
||||
|
|
||||
LL | / if i_16 > i16::MIN {
|
||||
@ -104,7 +104,7 @@ LL | | i_16 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:138:5
|
||||
|
|
||||
LL | / if i_16 > i16::MIN {
|
||||
@ -112,7 +112,7 @@ LL | | i_16 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:143:5
|
||||
|
|
||||
LL | / if i_16 != i16::MIN {
|
||||
@ -120,7 +120,7 @@ LL | | i_16 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:148:5
|
||||
|
|
||||
LL | / if i_16 != i16::MIN {
|
||||
@ -128,7 +128,7 @@ LL | | i_16 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_16 = i_16.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:158:5
|
||||
|
|
||||
LL | / if i_32 > i32::MIN {
|
||||
@ -136,7 +136,7 @@ LL | | i_32 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:163:5
|
||||
|
|
||||
LL | / if i_32 > i32::MIN {
|
||||
@ -144,7 +144,7 @@ LL | | i_32 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:168:5
|
||||
|
|
||||
LL | / if i_32 != i32::MIN {
|
||||
@ -152,7 +152,7 @@ LL | | i_32 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:173:5
|
||||
|
|
||||
LL | / if i_32 != i32::MIN {
|
||||
@ -160,7 +160,7 @@ LL | | i_32 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_32 = i_32.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:183:5
|
||||
|
|
||||
LL | / if i64::MIN < i_64 {
|
||||
@ -168,7 +168,7 @@ LL | | i_64 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:188:5
|
||||
|
|
||||
LL | / if i64::MIN != i_64 {
|
||||
@ -176,7 +176,7 @@ LL | | i_64 -= 1;
|
||||
LL | | }
|
||||
| |_____^ help: try: `i_64 = i_64.saturating_sub(1);`
|
||||
|
||||
error: Implicitly performing saturating subtraction
|
||||
error: implicitly performing saturating subtraction
|
||||
--> $DIR/implicit_saturating_sub.rs:193:5
|
||||
|
|
||||
LL | / if i64::MIN < i_64 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:9:13
|
||||
|
|
||||
LL | let _ = x >= y + 1;
|
||||
@ -6,19 +6,19 @@ LL | let _ = x >= y + 1;
|
||||
|
|
||||
= note: `-D clippy::int-plus-one` implied by `-D warnings`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:10:13
|
||||
|
|
||||
LL | let _ = y + 1 <= x;
|
||||
| ^^^^^^^^^^ help: change it to: `y < x`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:12:13
|
||||
|
|
||||
LL | let _ = x - 1 >= y;
|
||||
| ^^^^^^^^^^ help: change it to: `x > y`
|
||||
|
||||
error: Unnecessary `>= y + 1` or `x - 1 >=`
|
||||
error: unnecessary `>= y + 1` or `x - 1 >=`
|
||||
--> $DIR/int_plus_one.rs:13:13
|
||||
|
|
||||
LL | let _ = y <= x - 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Using `.iter().next()` on an array
|
||||
error: using `.iter().next()` on an array
|
||||
--> $DIR/iter_next_slice.rs:9:5
|
||||
|
|
||||
LL | s.iter().next();
|
||||
@ -6,19 +6,19 @@ LL | s.iter().next();
|
||||
|
|
||||
= note: `-D clippy::iter-next-slice` implied by `-D warnings`
|
||||
|
||||
error: Using `.iter().next()` on a Slice without end index.
|
||||
error: using `.iter().next()` on a Slice without end index
|
||||
--> $DIR/iter_next_slice.rs:12:5
|
||||
|
|
||||
LL | s[2..].iter().next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `s.get(2)`
|
||||
|
||||
error: Using `.iter().next()` on a Slice without end index.
|
||||
error: using `.iter().next()` on a Slice without end index
|
||||
--> $DIR/iter_next_slice.rs:15:5
|
||||
|
|
||||
LL | v[5..].iter().next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: try calling: `v.get(5)`
|
||||
|
||||
error: Using `.iter().next()` on an array
|
||||
error: using `.iter().next()` on an array
|
||||
--> $DIR/iter_next_slice.rs:18:5
|
||||
|
|
||||
LL | v.iter().next();
|
||||
|
@ -1,40 +1,40 @@
|
||||
error: You are using an explicit closure for copying elements
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:10:22
|
||||
|
|
||||
LL | let _: Vec<i8> = vec![5_i8; 6].iter().map(|x| *x).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![5_i8; 6].iter().copied()`
|
||||
|
|
||||
= note: `-D clippy::map-clone` implied by `-D warnings`
|
||||
|
||||
error: You are using an explicit closure for cloning elements
|
||||
error: you are using an explicit closure for cloning elements
|
||||
--> $DIR/map_clone.rs:11:26
|
||||
|
|
||||
LL | let _: Vec<String> = vec![String::new()].iter().map(|x| x.clone()).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `vec![String::new()].iter().cloned()`
|
||||
|
||||
error: You are using an explicit closure for copying elements
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:12:23
|
||||
|
|
||||
LL | let _: Vec<u32> = vec![42, 43].iter().map(|&x| x).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `vec![42, 43].iter().copied()`
|
||||
|
||||
error: You are using an explicit closure for copying elements
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:14:26
|
||||
|
|
||||
LL | let _: Option<u64> = Some(&16).map(|b| *b);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `copied` method: `Some(&16).copied()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&16).copied()`
|
||||
|
||||
error: You are using an explicit closure for copying elements
|
||||
error: you are using an explicit closure for copying elements
|
||||
--> $DIR/map_clone.rs:15:25
|
||||
|
|
||||
LL | let _: Option<u8> = Some(&1).map(|x| x.clone());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Consider calling the dedicated `copied` method: `Some(&1).copied()`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `Some(&1).copied()`
|
||||
|
||||
error: You are needlessly cloning iterator elements
|
||||
error: you are needlessly cloning iterator elements
|
||||
--> $DIR/map_clone.rs:26:29
|
||||
|
|
||||
LL | let _ = std::env::args().map(|v| v.clone());
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: Remove the `map` call
|
||||
| ^^^^^^^^^^^^^^^^^^^ help: remove the `map` call
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Consider using an `AtomicBool` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicBool` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:6:5
|
||||
|
|
||||
LL | Mutex::new(true);
|
||||
@ -6,31 +6,31 @@ LL | Mutex::new(true);
|
||||
|
|
||||
= note: `-D clippy::mutex-atomic` implied by `-D warnings`
|
||||
|
||||
error: Consider using an `AtomicUsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicUsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:7:5
|
||||
|
|
||||
LL | Mutex::new(5usize);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Consider using an `AtomicIsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicIsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:8:5
|
||||
|
|
||||
LL | Mutex::new(9isize);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Consider using an `AtomicPtr` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicPtr` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:10:5
|
||||
|
|
||||
LL | Mutex::new(&x as *const u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Consider using an `AtomicPtr` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicPtr` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:11:5
|
||||
|
|
||||
LL | Mutex::new(&mut x as *mut u32);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: Consider using an `AtomicUsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicUsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:12:5
|
||||
|
|
||||
LL | Mutex::new(0u32);
|
||||
@ -38,7 +38,7 @@ LL | Mutex::new(0u32);
|
||||
|
|
||||
= note: `-D clippy::mutex-integer` implied by `-D warnings`
|
||||
|
||||
error: Consider using an `AtomicIsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
|
||||
error: consider using an `AtomicIsize` instead of a `Mutex` here; if you just want the locking behavior and not the internal type, consider using `Mutex<()>`
|
||||
--> $DIR/mutex_atomic.rs:13:5
|
||||
|
|
||||
LL | Mutex::new(0i32);
|
||||
|
@ -1,4 +1,4 @@
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:7:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
@ -6,37 +6,37 @@ LL | vec.sort();
|
||||
|
|
||||
= note: `-D clippy::stable-sort-primitive` implied by `-D warnings`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:9:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
| ^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:11:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
| ^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:13:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
| ^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:15:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
| ^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:17:5
|
||||
|
|
||||
LL | vec.sort();
|
||||
| ^^^^^^^^^^ help: try: `vec.sort_unstable()`
|
||||
|
||||
error: Use sort_unstable instead of sort
|
||||
error: used sort instead of sort_unstable
|
||||
--> $DIR/stable_sort_primitive.rs:19:5
|
||||
|
|
||||
LL | arr.sort();
|
||||
|
Loading…
Reference in New Issue
Block a user