tests: add test that roughly ensures that our lint messages conform with the diagnostics convention of the rustc dev guide
lint message should not start with uppercase letters
lint messages should not have punctuation at the end of the last line
https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure
The test reads through all the .stderr files in the testsuit and checks lint messages that start with "help: ", "error: " etc.
There is also an exception list for special messages that are deemed acceptable.
changelog: make sure lint messages conform with the rustc dev guide and add test
clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
serde = { version = "1.0", features = ["derive"] }
derive-new = "0.5"
+regex = "1.4"
# A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
diag.span_suggestion(
expr.span,
&format!(
- "Did you mean `{} = {} {} {}` or `{}`? Consider replacing it with",
+ "did you mean `{} = {} {} {}` or `{}`? Consider replacing it with",
snip_a,
snip_a,
op.node.as_str(),
diag.span_suggestion(span, "try", sugg, Applicability::MaybeIncorrect);
if !unix_suggested && is_unix(os) {
- diag.help("Did you mean `unix`?");
+ diag.help("did you mean `unix`?");
unix_suggested = true;
}
}
cx,
AWAIT_HOLDING_LOCK,
ty_cause.span,
- "this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.",
+ "this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await",
ty_cause.scope_span.or(Some(span)),
"these are all the await points this lock is held through",
);
cx,
AWAIT_HOLDING_REFCELL_REF,
ty_cause.span,
- "this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.",
+ "this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await",
ty_cause.scope_span.or(Some(span)),
"these are all the await points this ref is held through",
);
expr.span,
"`if` chain can be rewritten with `match`",
None,
- "Consider rewriting the `if` chain to use `cmp` and `match`.",
+ "consider rewriting the `if` chain to use `cmp` and `match`",
)
}
}
}
const DROP_REF_SUMMARY: &str = "calls to `std::mem::drop` with a reference instead of an owned value. \
- Dropping a reference does nothing.";
+ Dropping a reference does nothing";
const FORGET_REF_SUMMARY: &str = "calls to `std::mem::forget` with a reference instead of an owned value. \
- Forgetting a reference does nothing.";
+ Forgetting a reference does nothing";
const DROP_COPY_SUMMARY: &str = "calls to `std::mem::drop` with a value that implements `Copy`. \
- Dropping a copy leaves the original intact.";
+ Dropping a copy leaves the original intact";
const FORGET_COPY_SUMMARY: &str = "calls to `std::mem::forget` with a value that implements `Copy`. \
- Forgetting a copy leaves the original intact.";
+ Forgetting a copy leaves the original intact";
declare_lint_pass!(DropForgetRef => [DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY]);
move |diag| {
diag.help(
"`From` is intended for infallible conversions only. \
- Use `TryFrom` if there's a possibility for the conversion to fail.");
+ Use `TryFrom` if there's a possibility for the conversion to fail");
diag.span_note(fpu.result, "potential failure(s)");
});
}
}
let help_msg = match (range.start, range.end) {
- (None, Some(_)) => "Consider using `.get(..n)`or `.get_mut(..n)` instead",
- (Some(_), None) => "Consider using `.get(n..)` or .get_mut(n..)` instead",
- (Some(_), Some(_)) => "Consider using `.get(n..m)` or `.get_mut(n..m)` instead",
+ (None, Some(_)) => "consider using `.get(..n)`or `.get_mut(..n)` instead",
+ (Some(_), None) => "consider using `.get(n..)` or .get_mut(n..)` instead",
+ (Some(_), Some(_)) => "consider using `.get(n..m)` or `.get_mut(n..m)` instead",
(None, None) => return, // [..] is ok.
};
- span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic.", None, help_msg);
+ span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic", None, help_msg);
} else {
// Catchall non-range index, i.e., [n] or [n << m]
if let ty::Array(..) = ty.kind() {
cx,
INDEXING_SLICING,
expr.span,
- "indexing may panic.",
+ "indexing may panic",
None,
- "Consider using `.get(n)` or `.get_mut(n)` instead",
+ "consider using `.get(n)` or `.get_mut(n)` instead",
);
}
}
expr.span,
"integer division",
None,
- "division of integers may cause loss of precision. consider using floats.",
+ "division of integers may cause loss of precision. consider using floats",
);
}
}
cx,
NEEDLESS_RANGE_LOOP,
expr.span,
- &format!(
- "the loop variable `{}` is only used to index `{}`.",
- ident.name, indexed
- ),
+ &format!("the loop variable `{}` is only used to index `{}`", ident.name, indexed),
|diag| {
multispan_sugg(
diag,
arg.span,
&format!(
"for loop over `{0}`, which is an `Option`. This is more readably written as an \
- `if let` statement.",
+ `if let` statement",
snippet(cx, arg.span, "_")
),
None,
arg.span,
&format!(
"for loop over `{0}`, which is a `Result`. This is more readably written as an \
- `if let` statement.",
+ `if let` statement",
snippet(cx, arg.span, "_")
),
None,
cx,
EXPLICIT_COUNTER_LOOP,
for_span.with_hi(arg.span.hi()),
- &format!("the variable `{}` is used as a loop counter.", name),
+ &format!("the variable `{}` is used as a loop counter", name),
"consider using",
format!(
"for ({}, {}) in {}.enumerate()",
fn get_suggestion_text(&self) -> &'static str {
match &self.func {
IterFunctionKind::IntoIter => {
- "Use the original Iterator instead of collecting it and then producing a new one"
+ "use the original Iterator instead of collecting it and then producing a new one"
},
IterFunctionKind::Len => {
- "Take the original Iterator's count instead of collecting it and finding the length"
+ "take the original Iterator's count instead of collecting it and finding the length"
},
IterFunctionKind::IsEmpty => {
- "Check if the original Iterator has anything instead of collecting it and seeing if it's empty"
+ "check if the original Iterator has anything instead of collecting it and seeing if it's empty"
},
IterFunctionKind::Contains(_) => {
- "Check if the original Iterator contains an element instead of collecting then checking"
+ "check if the original Iterator contains an element instead of collecting then checking"
},
}
}
cx,
WILDCARD_IN_OR_PATTERNS,
arm.pat.span,
- "wildcard pattern covers any other pattern as it will match anyway.",
+ "wildcard pattern covers any other pattern as it will match anyway",
None,
- "Consider handling `_` separately.",
+ "consider handling `_` separately",
);
}
}
cx,
ITERATOR_STEP_BY_ZERO,
expr.span,
- "Iterator::step_by(0) will panic at runtime",
+ "`Iterator::step_by(0)` will panic at runtime",
);
}
}
// lint if caller of `.filter().next()` is an Iterator
if match_trait_method(cx, expr, &paths::ITERATOR) {
let msg = "called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling \
- `.find(..)` instead.";
+ `.find(..)` instead";
let filter_snippet = snippet(cx, filter_args[1].span, "..");
if filter_snippet.lines().count() <= 1 {
let iter_snippet = snippet(cx, filter_args[0].span, "..");
}
let msg = "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling \
- `.find_map(..)` instead.";
+ `.find_map(..)` instead";
let filter_snippet = snippet(cx, filter_args[1].span, "..");
if filter_snippet.lines().count() <= 1 {
let iter_snippet = snippet(cx, filter_args[0].span, "..");
UNNECESSARY_LAZY_EVALUATIONS,
expr.span,
msg,
- &format!("Use `{}` instead", simplify_using),
+ &format!("use `{}` instead", simplify_using),
format!(
"{0}.{1}({2})",
snippet(cx, args[0].span, ".."),
TOPLEVEL_REF_ARG,
arg.pat.span,
"`ref` directly on a function argument is ignored. \
- Consider using a reference type instead.",
+ Consider using a reference type instead",
);
}
}
expr.span,
&format!(
"used binding `{}` which is prefixed with an underscore. A leading \
- underscore signals that a binding will not be used.",
+ underscore signals that a binding will not be used",
binding
),
);
cx,
NEEDLESS_QUESTION_MARK,
entire_expr.span,
- "Question mark operator is useless here",
+ "question mark operator is useless here",
"try",
format!("{}", utils::snippet(cx, inner_expr.span, r#""...""#)),
Applicability::MachineApplicable,
PTR_ARG,
arg.span,
"writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used \
- with non-Vec-based slices.",
+ with non-Vec-based slices",
|diag| {
if let Some(ref snippet) = get_only_generic_arg_snippet(cx, arg) {
diag.span_suggestion(
cx,
PTR_ARG,
arg.span,
- "writing `&String` instead of `&str` involves a new object where a slice will do.",
+ "writing `&String` instead of `&str` involves a new object where a slice will do",
|diag| {
diag.span_suggestion(arg.span, "change this to", "&str".into(), Applicability::Unspecified);
for (clonespan, suggestion) in spans {
cx,
PTR_ARG,
arg.span,
- "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.",
+ "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do",
|diag| {
diag.span_suggestion(
arg.span,
cx,
PTR_ARG,
arg.span,
- "using a reference to `Cow` is not recommended.",
+ "using a reference to `Cow` is not recommended",
"change this to",
"&".to_owned() + &r,
Applicability::Unspecified,
cx,
SUSPICIOUS_OPERATION_GROUPINGS,
span,
- "This sequence of operators looks suspiciously like a bug.",
- "I think you meant",
+ "this sequence of operators looks suspiciously like a bug",
+ "did you mean",
sugg,
applicability,
)
declare_lint_pass!(TransmutingNull => [TRANSMUTING_NULL]);
-const LINT_MSG: &str = "transmuting a known null pointer into a reference.";
+const LINT_MSG: &str = "transmuting a known null pointer into a reference";
impl<'tcx> LateLintPass<'tcx> for TransmutingNull {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
hir_ty.span,
"you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`",
None,
- "`Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.",
+ "`Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation",
);
return; // don't recurse into the type
}
cx,
VEC_BOX,
hir_ty.span,
- "`Vec<T>` is already on the heap, the boxing is unnecessary.",
+ "`Vec<T>` is already on the heap, the boxing is unnecessary",
"try",
format!("Vec<{}>", snippet(cx, boxed_ty.span, "..")),
Applicability::MachineApplicable,
cx,
LINKEDLIST,
hir_ty.span,
- "I see you're using a LinkedList! Perhaps you meant some other data structure?",
+ "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?",
None,
"a `VecDeque` might work",
);
"constant division of `0.0` with `0.0` will always result in NaN",
None,
&format!(
- "Consider using `{}::NAN` if you would like a constant representing NaN",
+ "consider using `{}::NAN` if you would like a constant representing NaN",
float_type,
),
);
-clippy 0.1.52 (5c6cd87b9 2021-02-25)
+clippy 0.1.52 (524f54c57 2021-02-26)
cargo-0.49.0/build.rs:1:null clippy::cargo_common_metadata "package `cargo` is missing `package.categories` metadata"
cargo-0.49.0/build.rs:1:null clippy::cargo_common_metadata "package `cargo` is missing `package.keywords` metadata"
cargo-0.49.0/src/bin/cargo/main.rs:1:null clippy::multiple_crate_versions "multiple versions for dependency `hex`: 0.3.2, 0.4.0"
cargo-0.49.0/src/bin/cargo/main.rs:1:null clippy::multiple_crate_versions "multiple versions for dependency `humantime`: 1.3.0, 2.0.0"
cargo-0.49.0/src/bin/cargo/main.rs:72:22 clippy::redundant_closure_for_method_calls "redundant closure found"
-cargo-0.49.0/src/bin/cargo/main.rs:79:40 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/bin/cargo/main.rs:94:13 clippy::match_wildcard_for_single_variants "wildcard match will miss any future added variants"
cargo-0.49.0/src/bin/cargo/main.rs:96:41 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/bin/cargo/main.rs:98:60 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:108:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:121:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:149:9 clippy::items_after_statements "adding items after statements is confusing, since items exist from the start of the scope"
-cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:411:9 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:411:9 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:420:69 clippy::doc_markdown "you should put `mode/target_kind` between ticks in the documentation"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:423:19 clippy::doc_markdown "you should put `CrateTypes` between ticks in the documentation"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:424:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/compiler/build_context/target_info.rs:98:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/core/compiler/build_plan.rs:4:9 clippy::doc_markdown "you should put `BuildPlan` between ticks in the documentation"
cargo-0.49.0/src/cargo/core/compiler/build_plan.rs:5:66 clippy::doc_markdown "you should put `BuildPlan` between ticks in the documentation"
-cargo-0.49.0/src/cargo/core/compiler/build_plan.rs:66:40 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
+cargo-0.49.0/src/cargo/core/compiler/build_plan.rs:66:40 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do"
cargo-0.49.0/src/cargo/core/compiler/compilation.rs:150:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/compiler/compilation.rs:150:5 clippy::missing_panics_doc "docs for function which may panic missing `# Panics` section"
cargo-0.49.0/src/cargo/core/compiler/compilation.rs:169:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:1980:17 clippy::similar_names "binding's name is too similar to existing binding"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:1980:24 clippy::manual_strip "stripping a prefix manually"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:1986:17 clippy::similar_names "binding's name is too similar to existing binding"
-cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:1986:27 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:2016:5 clippy::items_after_statements "adding items after statements is confusing, since items exist from the start of the scope"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:61:5 clippy::doc_markdown "you should put `CompileMode` between ticks in the documentation"
cargo-0.49.0/src/cargo/core/compiler/fingerprint.rs:63:12 clippy::doc_markdown "you should put `CompileKind` between ticks in the documentation"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:364:5 clippy::unnecessary_wraps "this function's return value is unnecessary"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:392:45 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:415:23 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
-cargo-0.49.0/src/cargo/core/compiler/mod.rs:464:18 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
-cargo-0.49.0/src/cargo/core/compiler/mod.rs:488:61 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do."
+cargo-0.49.0/src/cargo/core/compiler/mod.rs:464:18 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do"
+cargo-0.49.0/src/cargo/core/compiler/mod.rs:488:61 clippy::ptr_arg "writing `&PathBuf` instead of `&Path` involves a new object where a slice will do"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:667:15 clippy::similar_names "binding's name is too similar to existing binding"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:693:1 clippy::unnecessary_wraps "this function's return value is unnecessary"
cargo-0.49.0/src/cargo/core/compiler/mod.rs:725:42 clippy::match_same_arms "this `match` has identical arm bodies"
cargo-0.49.0/src/cargo/core/package.rs:459:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/package.rs:473:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/package.rs:587:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/core/package.rs:588:9 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/core/package.rs:588:9 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/core/package.rs:682:46 clippy::cast_possible_truncation "casting `f64` to `u64` may truncate the value"
cargo-0.49.0/src/cargo/core/package.rs:682:46 clippy::cast_sign_loss "casting `f64` to `u64` may lose the sign of the value"
cargo-0.49.0/src/cargo/core/package.rs:682:63 clippy::cast_possible_truncation "casting `f64` to `u64` may truncate the value"
cargo-0.49.0/src/cargo/core/package_id_spec.rs:231:9 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
cargo-0.49.0/src/cargo/core/package_id_spec.rs:51:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/package_id_spec.rs:51:5 clippy::missing_panics_doc "docs for function which may panic missing `# Panics` section"
-cargo-0.49.0/src/cargo/core/package_id_spec.rs:64:23 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/core/package_id_spec.rs:77:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/package_id_spec.rs:88:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/core/profiles.rs:1004:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:142:44 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:180:1 clippy::too_many_lines "this function has too many lines (225/100)"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:311:17 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
-cargo-0.49.0/src/cargo/core/resolver/mod.rs:421:52 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead."
-cargo-0.49.0/src/cargo/core/resolver/mod.rs:457:69 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead."
+cargo-0.49.0/src/cargo/core/resolver/mod.rs:421:52 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead"
+cargo-0.49.0/src/cargo/core/resolver/mod.rs:457:69 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:470:37 clippy::similar_names "binding's name is too similar to existing binding"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:607:11 clippy::needless_pass_by_value "this argument is passed by value, but not consumed in the function body"
cargo-0.49.0/src/cargo/core/resolver/mod.rs:631:21 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
cargo-0.49.0/src/cargo/core/workspace.rs:410:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/core/workspace.rs:440:9 clippy::unnecessary_wraps "this function's return value is unnecessarily wrapped by `Result`"
cargo-0.49.0/src/cargo/core/workspace.rs:511:32 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
-cargo-0.49.0/src/cargo/core/workspace.rs:531:13 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/core/workspace.rs:561:25 clippy::non_ascii_literal "literal non-ASCII character detected"
cargo-0.49.0/src/cargo/core/workspace.rs:613:13 clippy::filter_map "called `filter_map(..).map(..)` on an `Iterator`"
cargo-0.49.0/src/cargo/core/workspace.rs:615:22 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:242:1 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:249:1 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:258:1 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/ops/cargo_compile.rs:267:16 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/ops/cargo_compile.rs:267:16 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:275:1 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:275:1 clippy::too_many_lines "this function has too many lines (219/100)"
cargo-0.49.0/src/cargo/ops/cargo_compile.rs:468:9 clippy::default_trait_access "calling `std::collections::HashMap::default()` is more clear than this expression"
cargo-0.49.0/src/cargo/ops/cargo_new.rs:525:9 clippy::doc_markdown "you should put `format_existing` between ticks in the documentation"
cargo-0.49.0/src/cargo/ops/cargo_new.rs:572:34 clippy::match_same_arms "this `match` has identical arm bodies"
cargo-0.49.0/src/cargo/ops/cargo_new.rs:623:1 clippy::too_many_lines "this function has too many lines (130/100)"
-cargo-0.49.0/src/cargo/ops/cargo_new.rs:781:5 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead."
+cargo-0.49.0/src/cargo/ops/cargo_new.rs:781:5 clippy::filter_map_next "called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead"
cargo-0.49.0/src/cargo/ops/cargo_new.rs:800:16 clippy::single_match_else "you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`"
cargo-0.49.0/src/cargo/ops/cargo_output_metadata.rs:163:36 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/ops/cargo_output_metadata.rs:27:1 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/ops/vendor.rs:324:13 clippy::match_wildcard_for_single_variants "wildcard match will miss any future added variants"
cargo-0.49.0/src/cargo/ops/vendor.rs:70:1 clippy::too_many_lines "this function has too many lines (175/100)"
cargo-0.49.0/src/cargo/sources/config.rs:102:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/sources/config.rs:111:28 clippy::needless_question_mark "Question mark operator is useless here"
-cargo-0.49.0/src/cargo/sources/config.rs:133:48 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/sources/config.rs:111:28 clippy::needless_question_mark "question mark operator is useless here"
+cargo-0.49.0/src/cargo/sources/config.rs:133:48 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/sources/config.rs:135:67 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/sources/config.rs:206:36 clippy::needless_pass_by_value "this argument is passed by value, but not consumed in the function body"
cargo-0.49.0/src/cargo/sources/config.rs:282:9 clippy::items_after_statements "adding items after statements is confusing, since items exist from the start of the scope"
cargo-0.49.0/src/cargo/sources/directory.rs:90:56 clippy::redundant_closure_for_method_calls "redundant closure found"
cargo-0.49.0/src/cargo/sources/git/source.rs:14:1 clippy::module_name_repetitions "item name ends with its containing module's name"
cargo-0.49.0/src/cargo/sources/git/source.rs:25:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/sources/git/source.rs:34:25 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/sources/git/source.rs:49:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/sources/git/source.rs:53:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/sources/git/source.rs:53:5 clippy::missing_panics_doc "docs for function which may panic missing `# Panics` section"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:192:1 clippy::module_name_repetitions "item name starts with its containing module's name"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:203:1 clippy::module_name_repetitions "item name starts with its containing module's name"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:229:1 clippy::module_name_repetitions "item name starts with its containing module's name"
-cargo-0.49.0/src/cargo/sources/registry/mod.rs:340:24 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:372:1 clippy::module_name_repetitions "item name starts with its containing module's name"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:373:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/sources/registry/mod.rs:375:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/command_prelude.rs:234:1 clippy::must_use_candidate "this function could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/command_prelude.rs:249:1 clippy::must_use_candidate "this function could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/command_prelude.rs:264:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/command_prelude.rs:265:19 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/util/command_prelude.rs:279:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/command_prelude.rs:298:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/command_prelude.rs:320:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:1090:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:1166:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:1179:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/config/mod.rs:1181:33 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/util/config/mod.rs:1181:33 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/util/config/mod.rs:1184:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/config/mod.rs:1186:33 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/util/config/mod.rs:1186:33 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/util/config/mod.rs:1189:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/config/mod.rs:1191:33 clippy::needless_question_mark "Question mark operator is useless here"
+cargo-0.49.0/src/cargo/util/config/mod.rs:1191:33 clippy::needless_question_mark "question mark operator is useless here"
cargo-0.49.0/src/cargo/util/config/mod.rs:1203:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:1211:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:1216:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:214:13 clippy::match_wildcard_for_single_variants "wildcard match will miss any future added variants"
cargo-0.49.0/src/cargo/util/config/mod.rs:259:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:298:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/config/mod.rs:299:12 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/util/config/mod.rs:311:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:318:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:353:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:699:5 clippy::fn_params_excessive_bools "more than 3 bools in function parameters"
cargo-0.49.0/src/cargo/util/config/mod.rs:699:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/mod.rs:719:58 clippy::redundant_closure_for_method_calls "redundant closure found"
-cargo-0.49.0/src/cargo/util/config/mod.rs:748:30 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/util/config/mod.rs:816:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/config/path.rs:10:1 clippy::module_name_repetitions "item name ends with its containing module's name"
cargo-0.49.0/src/cargo/util/config/path.rs:14:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/interning.rs:66:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/interning.rs:77:5 clippy::must_use_candidate "this method could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/into_url.rs:10:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
-cargo-0.49.0/src/cargo/util/into_url_with_base.rs:14:24 clippy::manual_map "manual implementation of `Option::map`"
cargo-0.49.0/src/cargo/util/into_url_with_base.rs:9:5 clippy::missing_errors_doc "docs for function returning `Result` missing `# Errors` section"
cargo-0.49.0/src/cargo/util/job.rs:20:1 clippy::must_use_candidate "this function could have a `#[must_use]` attribute"
cargo-0.49.0/src/cargo/util/lev_distance.rs:3:1 clippy::must_use_candidate "this function could have a `#[must_use]` attribute"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2578:20 clippy::zero_ptr "`0 as *mut _` detected"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2588:13 clippy::zero_ptr "`0 as *mut _` detected"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2590:13 clippy::ptr_as_ptr "`as` casting between raw pointers without changing its mutability"
-libc-0.2.81/src/unix/linux_like/linux/mod.rs:2596:52 clippy::used_underscore_binding "used binding `_dummy` which is prefixed with an underscore. A leading underscore signals that a binding will not be used."
+libc-0.2.81/src/unix/linux_like/linux/mod.rs:2596:52 clippy::used_underscore_binding "used binding `_dummy` which is prefixed with an underscore. A leading underscore signals that a binding will not be used"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2597:11 clippy::cast_sign_loss "casting `i32` to `usize` may lose the sign of the value"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2601:21 clippy::explicit_iter_loop "it is more concise to loop over references to containers instead of using explicit iteration methods"
libc-0.2.81/src/unix/linux_like/linux/mod.rs:2611:9 clippy::unused_unit "unneeded unit expression"
rayon-1.5.0/src/iter/enumerate.rs:2:5 clippy::wildcard_imports "usage of wildcard import"
rayon-1.5.0/src/iter/enumerate.rs:64:9 clippy::items_after_statements "adding items after statements is confusing, since items exist from the start of the scope"
rayon-1.5.0/src/iter/enumerate.rs:68:9 clippy::items_after_statements "adding items after statements is confusing, since items exist from the start of the scope"
-rayon-1.5.0/src/iter/extend.rs:143:63 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:182:57 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:218:32 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:218:59 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:25:42 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:287:62 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:322:56 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:41:27 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:47:30 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:47:56 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:47:74 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:53:29 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:57:36 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
-rayon-1.5.0/src/iter/extend.rs:59:61 clippy::linkedlist "I see you're using a LinkedList! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:143:63 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:182:57 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:218:32 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:218:59 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:25:42 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:287:62 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:322:56 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:41:27 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:47:30 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:47:56 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:47:74 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:53:29 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:57:36 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
+rayon-1.5.0/src/iter/extend.rs:59:61 clippy::linkedlist "you seem to be using a `LinkedList`! Perhaps you meant some other data structure?"
rayon-1.5.0/src/iter/filter.rs:1:5 clippy::wildcard_imports "usage of wildcard import"
rayon-1.5.0/src/iter/filter.rs:2:5 clippy::wildcard_imports "usage of wildcard import"
rayon-1.5.0/src/iter/filter_map.rs:123:9 clippy::option_if_let_else "use Option::map_or instead of an if let/else"
clippy::needless_question_mark 8
clippy::wrong_self_convention 8
clippy::multiple_crate_versions 9
-clippy::manual_map 10
clippy::manual_range_contains 10
clippy::match_wildcard_for_single_variants 10
clippy::missing_safety_doc 10
--- /dev/null
+use std::ffi::OsStr;
+use std::path::PathBuf;
+
+use regex::RegexSet;
+
+#[derive(Debug)]
+struct Message {
+ path: PathBuf,
+ bad_lines: Vec<String>,
+}
+
+impl Message {
+ fn new(path: PathBuf) -> Self {
+ let content: String = std::fs::read_to_string(&path).unwrap();
+ // we don't want the first letter after "error: ", "help: " ... to be capitalized
+ // also no puncutation (except for "?" ?) at the end of a line
+ let regex_set: RegexSet = RegexSet::new(&[
+ r"error: [A-Z]",
+ r"help: [A-Z]",
+ r"warning: [A-Z]",
+ r"note: [A-Z]",
+ r"try this: [A-Z]",
+ r"error: .*[.!]$",
+ r"help: .*[.!]$",
+ r"warning: .*[.!]$",
+ r"note: .*[.!]$",
+ r"try this: .*[.!]$",
+ ])
+ .unwrap();
+
+ // sometimes the first character is capitalized and it is legal (like in "C-like enum variants") or
+ // we want to ask a question ending in "?"
+ let exceptions_set: RegexSet = RegexSet::new(&[
+ r".*C-like enum variant discriminant is not portable to 32-bit targets",
+ r".*did you mean `unix`?",
+ r".*the arguments may be inverted...",
+ r".*Intel x86 assembly syntax used",
+ r".*AT&T x86 assembly syntax used",
+ r".*remove .*the return type...",
+ r"note: Clippy version: .*",
+ r"the compiler unexpectedly panicked. this is a bug.",
+ ])
+ .unwrap();
+
+ let bad_lines = content
+ .lines()
+ .filter(|line| regex_set.matches(line).matched_any())
+ // ignore exceptions
+ .filter(|line| !exceptions_set.matches(line).matched_any())
+ .map(ToOwned::to_owned)
+ .collect::<Vec<String>>();
+
+ Message { path, bad_lines }
+ }
+}
+
+#[test]
+fn lint_message_convention() {
+ // disable the test inside the rustc test suite
+ if option_env!("RUSTC_TEST_SUITE").is_some() {
+ return;
+ }
+
+ // make sure that lint messages:
+ // * are not capitalized
+ // * don't have puncuation at the end of the last sentence
+
+ // these directories have interesting tests
+ let test_dirs = ["ui", "ui-cargo", "ui-internal", "ui-toml"]
+ .iter()
+ .map(PathBuf::from)
+ .map(|p| {
+ let base = PathBuf::from("tests");
+ base.join(p)
+ });
+
+ // gather all .stderr files
+ let tests = test_dirs
+ .flat_map(|dir| {
+ std::fs::read_dir(dir)
+ .expect("failed to read dir")
+ .map(|direntry| direntry.unwrap().path())
+ })
+ .filter(|file| matches!(file.extension().map(OsStr::to_str), Some(Some("stderr"))));
+
+ // get all files that have any "bad lines" in them
+ let bad_tests: Vec<Message> = tests
+ .map(Message::new)
+ .filter(|message| !message.bad_lines.is_empty())
+ .collect();
+
+ bad_tests.iter().for_each(|message| {
+ eprintln!(
+ "error: the test '{}' contained the following nonconforming lines :",
+ message.path.display()
+ );
+ message.bad_lines.iter().for_each(|line| eprintln!("{}", line));
+ eprintln!("\n\n");
+ });
+
+ eprintln!("\n\n\nLint message should not start with a capital letter and should not have punctuation at the end of the message unless multiple sentences are needed.");
+ eprintln!("Check out the rustc-dev-guide for more information:");
+ eprintln!("https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure\n\n\n");
+
+ assert!(bad_tests.is_empty());
+}
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/test.rs:9:12
|
LL | struct Foo(Vec<Box<u8>>);
|
= note: `-D clippy::vec-box` implied by `-D warnings`
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/test.rs:10:12
|
LL | struct Bar(Vec<Box<u32>>);
| ^^^^^^^^^^^^^ help: try: `Vec<u32>`
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/test.rs:13:18
|
LL | struct FooBarBaz(Vec<Box<C>>);
| ^^^^^^^^^^
|
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings`
-help: Did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
+help: did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
|
LL | a += 1;
| ^^^^^^
LL | a += 1 + a;
| ^^^^^^^^^^
|
-help: Did you mean `a = a + 1` or `a = a + 1 + a`? Consider replacing it with
+help: did you mean `a = a + 1` or `a = a + 1 + a`? Consider replacing it with
|
LL | a += 1;
| ^^^^^^
LL | a -= a - 1;
| ^^^^^^^^^^
|
-help: Did you mean `a = a - 1` or `a = a - (a - 1)`? Consider replacing it with
+help: did you mean `a = a - 1` or `a = a - (a - 1)`? Consider replacing it with
|
LL | a -= 1;
| ^^^^^^
LL | a *= a * 99;
| ^^^^^^^^^^^
|
-help: Did you mean `a = a * 99` or `a = a * a * 99`? Consider replacing it with
+help: did you mean `a = a * 99` or `a = a * a * 99`? Consider replacing it with
|
LL | a *= 99;
| ^^^^^^^
LL | a *= 42 * a;
| ^^^^^^^^^^^
|
-help: Did you mean `a = a * 42` or `a = a * 42 * a`? Consider replacing it with
+help: did you mean `a = a * 42` or `a = a * 42 * a`? Consider replacing it with
|
LL | a *= 42;
| ^^^^^^^
LL | a /= a / 2;
| ^^^^^^^^^^
|
-help: Did you mean `a = a / 2` or `a = a / (a / 2)`? Consider replacing it with
+help: did you mean `a = a / 2` or `a = a / (a / 2)`? Consider replacing it with
|
LL | a /= 2;
| ^^^^^^
LL | a %= a % 5;
| ^^^^^^^^^^
|
-help: Did you mean `a = a % 5` or `a = a % (a % 5)`? Consider replacing it with
+help: did you mean `a = a % 5` or `a = a % (a % 5)`? Consider replacing it with
|
LL | a %= 5;
| ^^^^^^
LL | a &= a & 1;
| ^^^^^^^^^^
|
-help: Did you mean `a = a & 1` or `a = a & a & 1`? Consider replacing it with
+help: did you mean `a = a & 1` or `a = a & a & 1`? Consider replacing it with
|
LL | a &= 1;
| ^^^^^^
LL | a *= a * a;
| ^^^^^^^^^^
|
-help: Did you mean `a = a * a` or `a = a * a * a`? Consider replacing it with
+help: did you mean `a = a * a` or `a = a * a * a`? Consider replacing it with
|
LL | a *= a;
| ^^^^^^
-error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.
+error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:7:9
|
LL | let guard = x.lock().unwrap();
LL | | }
| |_^
-error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.
+error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:28:9
|
LL | let guard = x.lock().unwrap();
LL | | }
| |_^
-error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.
+error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:41:13
|
LL | let guard = x.lock().unwrap();
LL | | };
| |_____^
-error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await.
+error: this MutexGuard is held across an 'await' point. Consider using an async-aware Mutex type or ensuring the MutexGuard is dropped before calling await
--> $DIR/await_holding_lock.rs:53:13
|
LL | let guard = x.lock().unwrap();
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:7:9
|
LL | let b = x.borrow();
LL | | }
| |_^
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:12:9
|
LL | let b = x.borrow_mut();
LL | | }
| |_^
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:33:9
|
LL | let b = x.borrow_mut();
LL | | }
| |_^
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:45:9
|
LL | let b = x.borrow_mut();
LL | | }
| |_^
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:60:13
|
LL | let b = x.borrow_mut();
LL | | };
| |_____^
-error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await.
+error: this RefCell Ref is held across an 'await' point. Consider ensuring the Ref is dropped before calling await
--> $DIR/await_holding_refcell_ref.rs:72:13
|
LL | let b = x.borrow_mut();
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::box-vec` implied by `-D warnings`
- = help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.
+ = help: `Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation
error: aborting due to previous error
| |_____^
|
= note: `-D clippy::comparison-chain` implied by `-D warnings`
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:27:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:35:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:43:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:117:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:123:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: `if` chain can be rewritten with `match`
--> $DIR/comparison_chain.rs:131:5
LL | | }
| |_____^
|
- = help: Consider rewriting the `if` chain to use `cmp` and `match`.
+ = help: consider rewriting the `if` chain to use `cmp` and `match`
error: aborting due to 7 previous errors
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:9:16
|
LL | type Baz = LinkedList<u8>;
= note: `-D clippy::linkedlist` implied by `-D warnings`
= help: a `VecDeque` might work
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:10:15
|
LL | fn foo(_: LinkedList<u8>);
|
= help: a `VecDeque` might work
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:11:23
|
LL | const BAR: Option<LinkedList<u8>>;
|
= help: a `VecDeque` might work
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:22:15
|
LL | fn foo(_: LinkedList<u8>) {}
|
= help: a `VecDeque` might work
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:25:39
|
LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
|
= help: a `VecDeque` might work
-error: I see you're using a LinkedList! Perhaps you meant some other data structure?
+error: you seem to be using a `LinkedList`! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:29:29
|
LL | pub fn test_ret() -> Option<LinkedList<u8>> {
-error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact.
+error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:33:5
|
LL | drop(s1);
LL | drop(s1);
| ^^
-error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact.
+error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:34:5
|
LL | drop(s2);
LL | drop(s2);
| ^^
-error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact.
+error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:36:5
|
LL | drop(s4);
LL | drop(s4);
| ^^
-error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact.
+error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:39:5
|
LL | forget(s1);
LL | forget(s1);
| ^^
-error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact.
+error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:40:5
|
LL | forget(s2);
LL | forget(s2);
| ^^
-error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact.
+error: calls to `std::mem::forget` with a value that implements `Copy`. Forgetting a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:42:5
|
LL | forget(s4);
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:11:5
|
LL | drop(&SomeStruct);
LL | drop(&SomeStruct);
| ^^^^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:14:5
|
LL | drop(&owned1);
LL | drop(&owned1);
| ^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:15:5
|
LL | drop(&&owned1);
LL | drop(&&owned1);
| ^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:16:5
|
LL | drop(&mut owned1);
LL | drop(&mut owned1);
| ^^^^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:20:5
|
LL | drop(reference1);
LL | drop(reference1);
| ^^^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:23:5
|
LL | drop(reference2);
LL | drop(reference2);
| ^^^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:26:5
|
LL | drop(reference3);
LL | drop(reference3);
| ^^^^^^^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:31:5
|
LL | drop(&val);
LL | drop(&val);
| ^^^^
-error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing.
+error: calls to `std::mem::drop` with a reference instead of an owned value. Dropping a reference does nothing
--> $DIR/drop_ref.rs:39:5
|
LL | std::mem::drop(&SomeStruct);
-error: the variable `_index` is used as a loop counter.
+error: the variable `_index` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:6:5
|
LL | for _v in &vec {
|
= note: `-D clippy::explicit-counter-loop` implied by `-D warnings`
-error: the variable `_index` is used as a loop counter.
+error: the variable `_index` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:12:5
|
LL | for _v in &vec {
| ^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter().enumerate()`
-error: the variable `_index` is used as a loop counter.
+error: the variable `_index` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:17:5
|
LL | for _v in &mut vec {
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.iter_mut().enumerate()`
-error: the variable `_index` is used as a loop counter.
+error: the variable `_index` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:22:5
|
LL | for _v in vec {
| ^^^^^^^^^^^^^ help: consider using: `for (_index, _v) in vec.into_iter().enumerate()`
-error: the variable `count` is used as a loop counter.
+error: the variable `count` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:61:9
|
LL | for ch in text.chars() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()`
-error: the variable `count` is used as a loop counter.
+error: the variable `count` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:72:9
|
LL | for ch in text.chars() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, ch) in text.chars().enumerate()`
-error: the variable `count` is used as a loop counter.
+error: the variable `count` is used as a loop counter
--> $DIR/explicit_counter_loop.rs:130:9
|
LL | for _i in 3..10 {
|
LL | #![deny(clippy::fallible_impl_from)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
- = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
+ = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:7:13
|
LL | | }
| |_^
|
- = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
+ = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:29:13
|
LL | | }
| |_^
|
- = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
+ = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:37:17
|
LL | | }
| |_^
|
- = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail.
+ = help: `From` is intended for infallible conversions only. Use `TryFrom` if there's a possibility for the conversion to fail
note: potential failure(s)
--> $DIR/fallible_impl_from.rs:55:12
|
-error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
+error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead
--> $DIR/filter_map_next.rs:7:26
|
LL | let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]
-error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
+error: called `filter_map(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead
--> $DIR/filter_map_next_fixable.rs:8:32
|
LL | let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
-error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
+error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
--> $DIR/for_loops_over_fallibles.rs:9:14
|
LL | for x in option {
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
= help: consider replacing `for x in option` with `if let Some(x) = option`
-error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement.
+error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
--> $DIR/for_loops_over_fallibles.rs:14:14
|
LL | for x in result {
|
= help: consider replacing `for x in result` with `if let Ok(x) = result`
-error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
+error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
--> $DIR/for_loops_over_fallibles.rs:18:14
|
LL | for x in option.ok_or("x not found") {
|
= note: `#[deny(clippy::iter_next_loop)]` on by default
-error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
+error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement
--> $DIR/for_loops_over_fallibles.rs:29:14
|
LL | for x in v.iter().next().and(Some(0)) {
|
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
-error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
+error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
--> $DIR/for_loops_over_fallibles.rs:33:14
|
LL | for x in v.iter().next().ok_or("x not found") {
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:10:5
|
LL | forget(&SomeStruct);
LL | forget(&SomeStruct);
| ^^^^^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:13:5
|
LL | forget(&owned);
LL | forget(&owned);
| ^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:14:5
|
LL | forget(&&owned);
LL | forget(&&owned);
| ^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:15:5
|
LL | forget(&mut owned);
LL | forget(&mut owned);
| ^^^^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:19:5
|
LL | forget(&*reference1);
LL | forget(&*reference1);
| ^^^^^^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:22:5
|
LL | forget(reference2);
LL | forget(reference2);
| ^^^^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:25:5
|
LL | forget(reference3);
LL | forget(reference3);
| ^^^^^^^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:30:5
|
LL | forget(&val);
LL | forget(&val);
| ^^^^
-error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing.
+error: calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing
--> $DIR/forget_ref.rs:38:5
|
LL | std::mem::forget(&SomeStruct);
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:10:5
|
LL | x[index];
| ^^^^^^^^
|
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:22:5
|
LL | v[0];
| ^^^^
|
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:23:5
|
LL | v[10];
| ^^^^^
|
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:24:5
|
LL | v[1 << 3];
| ^^^^^^^^^
|
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:30:5
|
LL | v[N];
| ^^^^
|
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
-error: indexing may panic.
+error: indexing may panic
--> $DIR/indexing_slicing_index.rs:31:5
|
LL | v[M];
| ^^^^
|
- = help: Consider using `.get(n)` or `.get_mut(n)` instead
+ = help: consider using `.get(n)` or `.get_mut(n)` instead
error: aborting due to 6 previous errors
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:12:6
|
LL | &x[index..];
| ^^^^^^^^^^
|
= note: `-D clippy::indexing-slicing` implied by `-D warnings`
- = help: Consider using `.get(n..)` or .get_mut(n..)` instead
+ = help: consider using `.get(n..)` or .get_mut(n..)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:13:6
|
LL | &x[..index];
| ^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:14:6
|
LL | &x[index_from..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
+ = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:15:6
|
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:15:6
|
LL | &x[index_from..][..index_to]; // Two lint reports, one for [index_from..] and another for [..index_to].
| ^^^^^^^^^^^^^^^
|
- = help: Consider using `.get(n..)` or .get_mut(n..)` instead
+ = help: consider using `.get(n..)` or .get_mut(n..)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:16:6
|
LL | &x[5..][..10]; // Two lint reports, one for out of bounds [5..] and another for slicing [..10].
| ^^^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:16:8
|
= note: `-D clippy::out-of-bounds-indexing` implied by `-D warnings`
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:17:6
|
LL | &x[0..][..3];
| ^^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:18:6
|
LL | &x[1..][..5];
| ^^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:25:12
LL | &y[..=4];
| ^
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:31:6
|
LL | &v[10..100];
| ^^^^^^^^^^
|
- = help: Consider using `.get(n..m)` or `.get_mut(n..m)` instead
+ = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:32:6
|
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^^^^^^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: range is out of bounds
--> $DIR/indexing_slicing_slice.rs:32:8
LL | &x[10..][..100]; // Two lint reports, one for [10..] and another for [..100].
| ^^
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:33:6
|
LL | &v[10..];
| ^^^^^^^
|
- = help: Consider using `.get(n..)` or .get_mut(n..)` instead
+ = help: consider using `.get(n..)` or .get_mut(n..)` instead
-error: slicing may panic.
+error: slicing may panic
--> $DIR/indexing_slicing_slice.rs:34:6
|
LL | &v[..100];
| ^^^^^^^^
|
- = help: Consider using `.get(..n)`or `.get_mut(..n)` instead
+ = help: consider using `.get(..n)`or `.get_mut(..n)` instead
error: aborting due to 16 previous errors
| ^^^^^
|
= note: `-D clippy::integer-division` implied by `-D warnings`
- = help: division of integers may cause loss of precision. consider using floats.
+ = help: division of integers may cause loss of precision. consider using floats
error: integer division
--> $DIR/integer_division.rs:6:13
LL | let o = 1 / two;
| ^^^^^^^
|
- = help: division of integers may cause loss of precision. consider using floats.
+ = help: division of integers may cause loss of precision. consider using floats
error: integer division
--> $DIR/integer_division.rs:7:13
LL | let p = two / 4;
| ^^^^^^^
|
- = help: division of integers may cause loss of precision. consider using floats.
+ = help: division of integers may cause loss of precision. consider using floats
error: aborting due to 3 previous errors
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:3:13
|
LL | let _ = vec!["A", "B", "B"].iter().step_by(0);
|
= note: `-D clippy::iterator-step-by-zero` implied by `-D warnings`
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:4:13
|
LL | let _ = "XXX".chars().step_by(0);
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:5:13
|
LL | let _ = (0..1).step_by(0);
| ^^^^^^^^^^^^^^^^^
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:14:13
|
LL | let _ = (1..).step_by(0);
| ^^^^^^^^^^^^^^^^
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:15:13
|
LL | let _ = (1..=2).step_by(0);
| ^^^^^^^^^^^^^^^^^^
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:18:13
|
LL | let _ = x.step_by(0);
| ^^^^^^^^^^^^
-error: Iterator::step_by(0) will panic at runtime
+error: `Iterator::step_by(0)` will panic at runtime
--> $DIR/iterator_step_by_zero.rs:22:13
|
LL | let _ = v1.iter().step_by(2 / 3);
|
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`
-error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead.
+error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> $DIR/methods.rs:126:13
|
LL | let _ = v.iter().filter(|&x| {
-error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead.
+error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> $DIR/methods_fixable.rs:10:13
|
LL | let _ = v.iter().filter(|&x| *x < 0).next();
| help: try: `target_os = "linux"`
|
= note: `-D clippy::mismatched-target-os` implied by `-D warnings`
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:9:1
| |
| help: try: `target_os = "freebsd"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:12:1
| |
| help: try: `target_os = "dragonfly"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:15:1
| |
| help: try: `target_os = "openbsd"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:18:1
| |
| help: try: `target_os = "netbsd"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:21:1
| |
| help: try: `target_os = "macos"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:24:1
| |
| help: try: `target_os = "ios"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:27:1
| |
| help: try: `target_os = "android"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:30:1
| |
| help: try: `target_os = "emscripten"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:33:1
| |
| help: try: `target_os = "fuchsia"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:36:1
| |
| help: try: `target_os = "haiku"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:39:1
| |
| help: try: `target_os = "illumos"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:42:1
| |
| help: try: `target_os = "l4re"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:45:1
| |
| help: try: `target_os = "redox"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:48:1
| |
| help: try: `target_os = "solaris"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:51:1
| |
| help: try: `target_os = "vxworks"`
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
error: operating system used in target family position
--> $DIR/mismatched_target_os_unix.rs:55:1
LL | #[cfg(all(not(any(solaris, linux)), freebsd))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = help: Did you mean `unix`?
+ = help: did you mean `unix`?
help: try
|
LL | #[cfg(all(not(any(target_os = "solaris", linux)), freebsd))]
| |____^
|
= note: `-D clippy::needless-collect` implied by `-D warnings`
-help: Use the original Iterator instead of collecting it and then producing a new one
+help: use the original Iterator instead of collecting it and then producing a new one
|
LL |
LL | sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
LL | | indirect_len.len();
| |____^
|
-help: Take the original Iterator's count instead of collecting it and finding the length
+help: take the original Iterator's count instead of collecting it and finding the length
|
LL |
LL | sample.iter().count();
LL | | indirect_empty.is_empty();
| |____^
|
-help: Check if the original Iterator has anything instead of collecting it and seeing if it's empty
+help: check if the original Iterator has anything instead of collecting it and seeing if it's empty
|
LL |
LL | sample.iter().next().is_none();
LL | | indirect_contains.contains(&&5);
| |____^
|
-help: Check if the original Iterator contains an element instead of collecting then checking
+help: check if the original Iterator contains an element instead of collecting then checking
|
LL |
LL | sample.iter().any(|x| x == &5);
LL | | non_copy_contains.contains(&a);
| |____^
|
-help: Check if the original Iterator contains an element instead of collecting then checking
+help: check if the original Iterator contains an element instead of collecting then checking
|
LL |
LL | sample.into_iter().any(|x| x == a);
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:23:12
|
LL | return Some(to.magic?);
|
= note: `-D clippy::needless-question-mark` implied by `-D warnings`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:31:12
|
LL | return Some(to.magic?)
| ^^^^^^^^^^^^^^^ help: try: `to.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:36:5
|
LL | Some(to.magic?)
| ^^^^^^^^^^^^^^^ help: try: `to.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:41:21
|
LL | to.and_then(|t| Some(t.magic?))
| ^^^^^^^^^^^^^^ help: try: `t.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:50:9
|
LL | Some(t.magic?)
| ^^^^^^^^^^^^^^ help: try: `t.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:55:12
|
LL | return Ok(tr.magic?);
| ^^^^^^^^^^^^^ help: try: `tr.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:62:12
|
LL | return Ok(tr.magic?)
| ^^^^^^^^^^^^^ help: try: `tr.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:66:5
|
LL | Ok(tr.magic?)
| ^^^^^^^^^^^^^ help: try: `tr.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:70:21
|
LL | tr.and_then(|t| Ok(t.magic?))
| ^^^^^^^^^^^^ help: try: `t.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:78:9
|
LL | Ok(t.magic?)
| ^^^^^^^^^^^^ help: try: `t.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:85:16
|
LL | return Ok(t.magic?);
| ^^^^^^^^^^^^ help: try: `t.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:138:9
|
LL | Ok(to.magic?) // should be triggered
| ^^^^^^^^^^^^^ help: try: `to.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:154:9
|
LL | Some(to.magic?) // should be triggered
| ^^^^^^^^^^^^^^^ help: try: `to.magic`
-error: Question mark operator is useless here
+error: question mark operator is useless here
--> $DIR/needless_question_mark.rs:162:9
|
LL | Ok(to.magic?) // should be triggered
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:10:14
|
LL | for i in 0..vec.len() {
LL | for <item> in &vec {
| ^^^^^^ ^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:19:14
|
LL | for i in 0..vec.len() {
LL | for <item> in &vec {
| ^^^^^^ ^^^^
-error: the loop variable `j` is only used to index `STATIC`.
+error: the loop variable `j` is only used to index `STATIC`
--> $DIR/needless_range_loop.rs:24:14
|
LL | for j in 0..4 {
LL | for <item> in &STATIC {
| ^^^^^^ ^^^^^^^
-error: the loop variable `j` is only used to index `CONST`.
+error: the loop variable `j` is only used to index `CONST`
--> $DIR/needless_range_loop.rs:28:14
|
LL | for j in 0..4 {
LL | for (i, <item>) in vec.iter().enumerate() {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec2`.
+error: the loop variable `i` is only used to index `vec2`
--> $DIR/needless_range_loop.rs:40:14
|
LL | for i in 0..vec.len() {
LL | for <item> in vec2.iter().take(vec.len()) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:44:14
|
LL | for i in 5..vec.len() {
LL | for <item> in vec.iter().skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:48:14
|
LL | for i in 0..MAX_LEN {
LL | for <item> in vec.iter().take(MAX_LEN) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:52:14
|
LL | for i in 0..=MAX_LEN {
LL | for <item> in vec.iter().take(MAX_LEN + 1) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:56:14
|
LL | for i in 5..10 {
LL | for <item> in vec.iter().take(10).skip(5) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop.rs:60:14
|
LL | for i in 5..=10 {
-error: the loop variable `i` is only used to index `ns`.
+error: the loop variable `i` is only used to index `ns`
--> $DIR/needless_range_loop2.rs:10:14
|
LL | for i in 3..10 {
LL | for <item> in ns.iter().take(10).skip(3) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `ms`.
+error: the loop variable `i` is only used to index `ms`
--> $DIR/needless_range_loop2.rs:31:14
|
LL | for i in 0..ms.len() {
LL | for <item> in &mut ms {
| ^^^^^^ ^^^^^^^
-error: the loop variable `i` is only used to index `ms`.
+error: the loop variable `i` is only used to index `ms`
--> $DIR/needless_range_loop2.rs:37:14
|
LL | for i in 0..ms.len() {
LL | for <item> in &mut ms {
| ^^^^^^ ^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop2.rs:61:14
|
LL | for i in x..x + 4 {
LL | for <item> in vec.iter_mut().skip(x).take(4) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `vec`.
+error: the loop variable `i` is only used to index `vec`
--> $DIR/needless_range_loop2.rs:68:14
|
LL | for i in x..=x + 4 {
LL | for <item> in vec.iter_mut().skip(x).take(4 + 1) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `arr`.
+error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:74:14
|
LL | for i in 0..3 {
LL | for <item> in &arr {
| ^^^^^^ ^^^^
-error: the loop variable `i` is only used to index `arr`.
+error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:78:14
|
LL | for i in 0..2 {
LL | for <item> in arr.iter().take(2) {
| ^^^^^^ ^^^^^^^^^^^^^^^^^^
-error: the loop variable `i` is only used to index `arr`.
+error: the loop variable `i` is only used to index `arr`
--> $DIR/needless_range_loop2.rs:82:14
|
LL | for i in 1..3 {
-error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
+error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
--> $DIR/ptr_arg.rs:7:14
|
LL | fn do_vec(x: &Vec<i64>) {
|
= note: `-D clippy::ptr-arg` implied by `-D warnings`
-error: writing `&String` instead of `&str` involves a new object where a slice will do.
+error: writing `&String` instead of `&str` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:16:14
|
LL | fn do_str(x: &String) {
| ^^^^^^^ help: change this to: `&str`
-error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
+error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:25:15
|
LL | fn do_path(x: &PathBuf) {
| ^^^^^^^^ help: change this to: `&Path`
-error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
+error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
--> $DIR/ptr_arg.rs:38:18
|
LL | fn do_vec(x: &Vec<i64>);
| ^^^^^^^^^ help: change this to: `&[i64]`
-error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
+error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
--> $DIR/ptr_arg.rs:51:14
|
LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
LL | x.to_owned()
|
-error: writing `&String` instead of `&str` involves a new object where a slice will do.
+error: writing `&String` instead of `&str` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:60:18
|
LL | fn str_cloned(x: &String) -> String {
LL | x.to_string()
|
-error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
+error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:68:19
|
LL | fn path_cloned(x: &PathBuf) -> PathBuf {
LL | x.to_path_buf()
|
-error: writing `&String` instead of `&str` involves a new object where a slice will do.
+error: writing `&String` instead of `&str` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:76:44
|
LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
LL | let c = y;
| ^
-error: using a reference to `Cow` is not recommended.
+error: using a reference to `Cow` is not recommended
--> $DIR/ptr_arg.rs:90:25
|
LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
| ^^^^^^^^^^^ help: change this to: `&[i32]`
-error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
+error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
--> $DIR/ptr_arg.rs:143:21
|
LL | fn foo_vec(vec: &Vec<u8>) {
LL | let _ = vec.to_owned().clone();
| ^^^^^^^^^^^^^^
-error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
+error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:148:23
|
LL | fn foo_path(path: &PathBuf) {
LL | let _ = path.to_path_buf().clone();
| ^^^^^^^^^^^^^^^^^^
-error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
+error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> $DIR/ptr_arg.rs:153:21
|
LL | fn foo_str(str: &PathBuf) {
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:14:9
|
LL | self.x == other.y && self.y == other.y && self.z == other.z
- | ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
+ | ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
|
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:14:9
|
LL | self.x == other.y && self.y == other.y && self.z == other.z
- | ^^^^^^^^^^^^^^^^^ help: I think you meant: `self.x == other.x`
+ | ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:27:20
|
LL | s1.a < s2.a && s1.a < s2.b
- | ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:75:33
|
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:80:19
|
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:80:19
|
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:85:19
|
LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:90:19
|
LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:95:5
|
LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.a * s2.a`
+ | ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:100:33
|
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:113:20
|
LL | (s1.a * s2.a + s1.b * s1.b)
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:118:34
|
LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d)
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:123:38
|
LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:128:39
|
LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:133:42
|
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:133:42
|
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:138:40
|
LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d))
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:143:40
|
LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)))
- | ^^^^^^^^^^^ help: I think you meant: `s1.c * s2.c`
+ | ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:148:20
|
LL | (s1.a * s2.a + s2.b * s2.b) / 2
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:153:35
|
LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b)
- | ^^^^^^^^^^^ help: I think you meant: `s1.b * s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:158:29
|
LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d
- | ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
+ | ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:163:17
|
LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d
- | ^^^^^^^^^^^^ help: I think you meant: `s1.c == s2.c`
+ | ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:172:77
|
LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.1).0
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: I think you meant: `(n1.inner.2).0 == (n2.inner.2).0`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:186:25
|
LL | s1.a <= s2.a && s1.a <= s2.b
- | ^^^^^^^^^^^^ help: I think you meant: `s1.b <= s2.b`
+ | ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:192:23
|
LL | if s1.a < s2.a && s1.a < s2.b {
- | ^^^^^^^^^^^ help: I think you meant: `s1.b < s2.b`
+ | ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:199:48
|
LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d)))
- | ^^^^^^^^^^^^^ help: I think you meant: `-s1.c * -s2.c`
+ | ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c`
-error: This sequence of operators looks suspiciously like a bug.
+error: this sequence of operators looks suspiciously like a bug
--> $DIR/suspicious_operation_groupings.rs:204:27
|
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
- | ^^^^^^^^^^^^^ help: I think you meant: `-s1.b < -s2.b`
+ | ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
error: aborting due to 27 previous errors
-error: `ref` directly on a function argument is ignored. Consider using a reference type instead.
+error: `ref` directly on a function argument is ignored. Consider using a reference type instead
--> $DIR/toplevel_ref_arg_non_rustfix.rs:9:15
|
LL | fn the_answer(ref mut x: u8) {
|
= note: `-D clippy::toplevel-ref-arg` implied by `-D warnings`
-error: `ref` directly on a function argument is ignored. Consider using a reference type instead.
+error: `ref` directly on a function argument is ignored. Consider using a reference type instead
--> $DIR/toplevel_ref_arg_non_rustfix.rs:15:24
|
LL | fn fun_example(ref _x: usize) {}
-error: transmuting a known null pointer into a reference.
+error: transmuting a known null pointer into a reference
--> $DIR/transmuting_null.rs:10:23
|
LL | let _: &u64 = std::mem::transmute(0 as *const u64);
|
= note: `-D clippy::transmuting-null` implied by `-D warnings`
-error: transmuting a known null pointer into a reference.
+error: transmuting a known null pointer into a reference
--> $DIR/transmuting_null.rs:11:23
|
LL | let _: &u64 = std::mem::transmute(std::ptr::null::<u64>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: transmuting a known null pointer into a reference.
+error: transmuting a known null pointer into a reference
--> $DIR/transmuting_null.rs:21:23
|
LL | let _: &u64 = std::mem::transmute(ZPTR);
--> $DIR/unnecessary_lazy_eval.rs:35:13
|
LL | let _ = opt.unwrap_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `opt.unwrap_or(2)`
|
= note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
--> $DIR/unnecessary_lazy_eval.rs:36:13
|
LL | let _ = opt.unwrap_or_else(|| astronomers_pi);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(astronomers_pi)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `opt.unwrap_or(astronomers_pi)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:37:13
|
LL | let _ = opt.unwrap_or_else(|| ext_str.some_field);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `opt.unwrap_or(ext_str.some_field)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `opt.unwrap_or(ext_str.some_field)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:39:13
|
LL | let _ = opt.and_then(|_| ext_opt);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `opt.and(ext_opt)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `opt.and(ext_opt)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:40:13
|
LL | let _ = opt.or_else(|| ext_opt);
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(ext_opt)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `opt.or(ext_opt)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:41:13
|
LL | let _ = opt.or_else(|| None);
- | ^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(None)`
+ | ^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `opt.or(None)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:42:13
|
LL | let _ = opt.get_or_insert_with(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `opt.get_or_insert(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `get_or_insert` instead: `opt.get_or_insert(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:43:13
|
LL | let _ = opt.ok_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `opt.ok_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^ help: use `ok_or` instead: `opt.ok_or(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:44:13
|
LL | let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2)));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `nested_tuple_opt.unwrap_or(Some((1, 2)))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `nested_tuple_opt.unwrap_or(Some((1, 2)))`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:47:13
|
LL | let _ = Some(10).unwrap_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Some(10).unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `Some(10).unwrap_or(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:48:13
|
LL | let _ = Some(10).and_then(|_| ext_opt);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `Some(10).and(ext_opt)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `Some(10).and(ext_opt)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:49:28
|
LL | let _: Option<usize> = None.or_else(|| ext_opt);
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(ext_opt)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `None.or(ext_opt)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:50:13
|
LL | let _ = None.get_or_insert_with(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `None.get_or_insert(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `get_or_insert` instead: `None.get_or_insert(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:51:35
|
LL | let _: Result<usize, usize> = None.ok_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `None.ok_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^ help: use `ok_or` instead: `None.ok_or(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:52:28
|
LL | let _: Option<usize> = None.or_else(|| None);
- | ^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(None)`
+ | ^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `None.or(None)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:55:13
|
LL | let _ = deep.0.unwrap_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `deep.0.unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `deep.0.unwrap_or(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:56:13
|
LL | let _ = deep.0.and_then(|_| ext_opt);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `deep.0.and(ext_opt)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `deep.0.and(ext_opt)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:57:13
|
LL | let _ = deep.0.or_else(|| None);
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `deep.0.or(None)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `deep.0.or(None)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:58:13
|
LL | let _ = deep.0.get_or_insert_with(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `get_or_insert` instead: `deep.0.get_or_insert(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `get_or_insert` instead: `deep.0.get_or_insert(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:59:13
|
LL | let _ = deep.0.ok_or_else(|| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `ok_or` instead: `deep.0.ok_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `ok_or` instead: `deep.0.ok_or(2)`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:79:28
|
LL | let _: Option<usize> = None.or_else(|| Some(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `None.or(Some(3))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `None.or(Some(3))`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:80:13
|
LL | let _ = deep.0.or_else(|| Some(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `deep.0.or(Some(3))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `deep.0.or(Some(3))`
error: unnecessary closure used to substitute value for `Option::None`
--> $DIR/unnecessary_lazy_eval.rs:81:13
|
LL | let _ = opt.or_else(|| Some(3));
- | ^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `opt.or(Some(3))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `opt.or(Some(3))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:87:13
|
LL | let _ = res2.unwrap_or_else(|_| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `res2.unwrap_or(2)`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:88:13
|
LL | let _ = res2.unwrap_or_else(|_| astronomers_pi);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(astronomers_pi)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `res2.unwrap_or(astronomers_pi)`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:89:13
|
LL | let _ = res2.unwrap_or_else(|_| ext_str.some_field);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `res2.unwrap_or(ext_str.some_field)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `res2.unwrap_or(ext_str.some_field)`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:111:35
|
LL | let _: Result<usize, usize> = res.and_then(|_| Err(2));
- | ^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(2))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `res.and(Err(2))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:112:35
|
LL | let _: Result<usize, usize> = res.and_then(|_| Err(astronomers_pi));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(astronomers_pi))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `res.and(Err(astronomers_pi))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:113:35
|
LL | let _: Result<usize, usize> = res.and_then(|_| Err(ext_str.some_field));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `and` instead: `res.and(Err(ext_str.some_field))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `and` instead: `res.and(Err(ext_str.some_field))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:115:35
|
LL | let _: Result<usize, usize> = res.or_else(|_| Ok(2));
- | ^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(2))`
+ | ^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `res.or(Ok(2))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:116:35
|
LL | let _: Result<usize, usize> = res.or_else(|_| Ok(astronomers_pi));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(astronomers_pi))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `res.or(Ok(astronomers_pi))`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval.rs:117:35
|
LL | let _: Result<usize, usize> = res.or_else(|_| Ok(ext_str.some_field));
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `or` instead: `res.or(Ok(ext_str.some_field))`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `or` instead: `res.or(Ok(ext_str.some_field))`
error: aborting due to 32 previous errors
--> $DIR/unnecessary_lazy_eval_unfixable.rs:12:13
|
LL | let _ = Ok(1).unwrap_or_else(|()| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
|
= note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
--> $DIR/unnecessary_lazy_eval_unfixable.rs:16:13
|
LL | let _ = Ok(1).unwrap_or_else(|e::E| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
error: unnecessary closure used to substitute value for `Result::Err`
--> $DIR/unnecessary_lazy_eval_unfixable.rs:17:13
|
LL | let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: Use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `unwrap_or` instead: `Ok(1).unwrap_or(2)`
error: aborting due to 3 previous errors
-error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:26:5
|
LL | _foo + 1
|
= note: `-D clippy::used-underscore-binding` implied by `-D warnings`
-error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:31:20
|
LL | println!("{}", _foo);
| ^^^^
-error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:32:16
|
LL | assert_eq!(_foo, _foo);
| ^^^^
-error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_foo` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:32:22
|
LL | assert_eq!(_foo, _foo);
| ^^^^
-error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_underscore_field` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:45:5
|
LL | s._underscore_field += 1;
| ^^^^^^^^^^^^^^^^^^^
-error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used.
+error: used binding `_i` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
--> $DIR/used_underscore_binding.rs:100:16
|
LL | uses_i(_i);
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/vec_box_sized.rs:14:21
|
LL | sized_type: Vec<Box<SizedStruct>>,
|
= note: `-D clippy::vec-box` implied by `-D warnings`
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/vec_box_sized.rs:17:14
|
LL | struct A(Vec<Box<SizedStruct>>);
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Vec<SizedStruct>`
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/vec_box_sized.rs:18:18
|
LL | struct B(Vec<Vec<Box<(u32)>>>);
| ^^^^^^^^^^^^^^^ help: try: `Vec<u32>`
-error: `Vec<T>` is already on the heap, the boxing is unnecessary.
+error: `Vec<T>` is already on the heap, the boxing is unnecessary
--> $DIR/vec_box_sized.rs:46:23
|
LL | pub fn f() -> Vec<Box<S>> {
-error: wildcard pattern covers any other pattern as it will match anyway.
+error: wildcard pattern covers any other pattern as it will match anyway
--> $DIR/wild_in_or_pats.rs:8:9
|
LL | "bar" | _ => {
| ^^^^^^^^^
|
= note: `-D clippy::wildcard-in-or-patterns` implied by `-D warnings`
- = help: Consider handling `_` separately.
+ = help: consider handling `_` separately
-error: wildcard pattern covers any other pattern as it will match anyway.
+error: wildcard pattern covers any other pattern as it will match anyway
--> $DIR/wild_in_or_pats.rs:16:9
|
LL | "bar" | "bar2" | _ => {
| ^^^^^^^^^^^^^^^^^^
|
- = help: Consider handling `_` separately.
+ = help: consider handling `_` separately
-error: wildcard pattern covers any other pattern as it will match anyway.
+error: wildcard pattern covers any other pattern as it will match anyway
--> $DIR/wild_in_or_pats.rs:24:9
|
LL | _ | "bar" | _ => {
| ^^^^^^^^^^^^^
|
- = help: Consider handling `_` separately.
+ = help: consider handling `_` separately
-error: wildcard pattern covers any other pattern as it will match anyway.
+error: wildcard pattern covers any other pattern as it will match anyway
--> $DIR/wild_in_or_pats.rs:32:9
|
LL | _ | "bar" => {
| ^^^^^^^^^
|
- = help: Consider handling `_` separately.
+ = help: consider handling `_` separately
error: aborting due to 4 previous errors
| ^^^^^^^^^
|
= note: `-D clippy::zero-divided-by-zero` implied by `-D warnings`
- = help: Consider using `f64::NAN` if you would like a constant representing NaN
+ = help: consider using `f64::NAN` if you would like a constant representing NaN
error: equal expressions as operands to `/`
--> $DIR/zero_div_zero.rs:5:19
LL | let f64_nan = 0.0 / 0.0f64;
| ^^^^^^^^^^^^
|
- = help: Consider using `f64::NAN` if you would like a constant representing NaN
+ = help: consider using `f64::NAN` if you would like a constant representing NaN
error: equal expressions as operands to `/`
--> $DIR/zero_div_zero.rs:6:25
LL | let other_f64_nan = 0.0f64 / 0.0;
| ^^^^^^^^^^^^
|
- = help: Consider using `f64::NAN` if you would like a constant representing NaN
+ = help: consider using `f64::NAN` if you would like a constant representing NaN
error: equal expressions as operands to `/`
--> $DIR/zero_div_zero.rs:7:28
LL | let one_more_f64_nan = 0.0f64 / 0.0f64;
| ^^^^^^^^^^^^^^^
|
- = help: Consider using `f64::NAN` if you would like a constant representing NaN
+ = help: consider using `f64::NAN` if you would like a constant representing NaN
error: aborting due to 8 previous errors