Auto merge of #5000 - JohnTitor:backticks, r=flip1995

Normalize lint messages

On rustc diagnostics, we prefer to use backticks over `'`,  `"`, or something else. I think we should follow their manner here.
In first commit, normalizes lint messages with backticks.
In second commit, updates all stderrs.
In third commit, updates descriptions on lintlist.

changelog: none
This commit is contained in:
bors 2020-01-07 11:52:23 +00:00
commit c092068996
112 changed files with 680 additions and 674 deletions

View File

@ -209,7 +209,7 @@ fn lint_misrefactored_assign_op(
db.span_suggestion( db.span_suggestion(
expr.span, expr.span,
&format!( &format!(
"Did you mean {} = {} {} {} or {}? Consider replacing it with", "Did you mean `{} = {} {} {}` or `{}`? Consider replacing it with",
snip_a, snip_a,
snip_a, snip_a,
op.node.as_str(), op.node.as_str(),

View File

@ -187,7 +187,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub DEPRECATED_CFG_ATTR, pub DEPRECATED_CFG_ATTR,
complexity, complexity,
"usage of `cfg_attr(rustfmt)` instead of `tool_attributes`" "usage of `cfg_attr(rustfmt)` instead of tool attributes"
} }
declare_lint_pass!(Attributes => [ declare_lint_pass!(Attributes => [
@ -449,7 +449,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
EMPTY_LINE_AFTER_OUTER_ATTR, EMPTY_LINE_AFTER_OUTER_ATTR,
begin_of_attr_to_item, begin_of_attr_to_item,
"Found an empty line after an outer attribute. \ "Found an empty line after an outer attribute. \
Perhaps you forgot to add a '!' to make it an inner attribute?", Perhaps you forgot to add a `!` to make it an inner attribute?",
); );
} }
} }
@ -520,7 +520,7 @@ impl EarlyLintPass for DeprecatedCfgAttribute {
cx, cx,
DEPRECATED_CFG_ATTR, DEPRECATED_CFG_ATTR,
attr.span, attr.span,
"`cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes", "`cfg_attr` is deprecated for rustfmt and got replaced by tool attributes",
"use", "use",
"#[rustfmt::skip]".to_string(), "#[rustfmt::skip]".to_string(),
Applicability::MachineApplicable, Applicability::MachineApplicable,

View File

@ -68,8 +68,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
} }
const BRACED_EXPR_MESSAGE: &str = "omit braces around single expression condition"; const BRACED_EXPR_MESSAGE: &str = "omit braces around single expression condition";
const COMPLEX_BLOCK_MESSAGE: &str = "in an 'if' condition, avoid complex blocks or closures with blocks; \ const COMPLEX_BLOCK_MESSAGE: &str = "in an `if` condition, avoid complex blocks or closures with blocks; \
instead, move the block or closure higher and bind it with a 'let'"; instead, move the block or closure higher and bind it with a `let`";
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {

View File

@ -138,7 +138,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: &
if expr.span.ctxt() != inner.span.ctxt() { if expr.span.ctxt() != inner.span.ctxt() {
return; return;
} }
span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| { span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this `if` statement can be collapsed", |db| {
let lhs = Sugg::ast(cx, check, ".."); let lhs = Sugg::ast(cx, check, "..");
let rhs = Sugg::ast(cx, check_inner, ".."); let rhs = Sugg::ast(cx, check_inner, "..");
db.span_suggestion( db.span_suggestion(

View File

@ -38,7 +38,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub IFS_SAME_COND, pub IFS_SAME_COND,
correctness, correctness,
"consecutive `ifs` with the same condition" "consecutive `if`s with the same condition"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -85,7 +85,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub SAME_FUNCTIONS_IN_IF_CONDITION, pub SAME_FUNCTIONS_IN_IF_CONDITION,
pedantic, pedantic,
"consecutive `ifs` with the same function call" "consecutive `if`s with the same function call"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -106,7 +106,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub IF_SAME_THEN_ELSE, pub IF_SAME_THEN_ELSE,
correctness, correctness,
"if with the same *then* and *else* blocks" "`if` with the same `then` and `else` blocks"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -206,7 +206,7 @@ fn lint_same_cond(cx: &LateContext<'_, '_>, conds: &[&Expr<'_>]) {
cx, cx,
IFS_SAME_COND, IFS_SAME_COND,
j.span, j.span,
"this `if` has the same condition as a previous if", "this `if` has the same condition as a previous `if`",
i.span, i.span,
"same as this", "same as this",
); );
@ -234,7 +234,7 @@ fn lint_same_fns_in_if_cond(cx: &LateContext<'_, '_>, conds: &[&Expr<'_>]) {
cx, cx,
SAME_FUNCTIONS_IN_IF_CONDITION, SAME_FUNCTIONS_IN_IF_CONDITION,
j.span, j.span,
"this `if` has the same function call as a previous if", "this `if` has the same function call as a previous `if`",
i.span, i.span,
"same as this", "same as this",
); );
@ -300,7 +300,7 @@ fn lint_match_arms<'tcx>(cx: &LateContext<'_, 'tcx>, expr: &Expr<'_>) {
db.span_note( db.span_note(
i.body.span, i.body.span,
&format!( &format!(
"`{}` has the same arm body as the `_` wildcard, consider removing it`", "`{}` has the same arm body as the `_` wildcard, consider removing it",
lhs lhs
), ),
); );

View File

@ -26,7 +26,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub DEFAULT_TRAIT_ACCESS, pub DEFAULT_TRAIT_ACCESS,
pedantic, pedantic,
"checks for literal calls to Default::default()" "checks for literal calls to `Default::default()`"
} }
declare_lint_pass!(DefaultTraitAccess => [DEFAULT_TRAIT_ACCESS]); declare_lint_pass!(DefaultTraitAccess => [DEFAULT_TRAIT_ACCESS]);
@ -62,7 +62,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
cx, cx,
DEFAULT_TRAIT_ACCESS, DEFAULT_TRAIT_ACCESS,
expr.span, expr.span,
&format!("Calling {} is more clear than this expression", replacement), &format!("Calling `{}` is more clear than this expression", replacement),
"try", "try",
replacement, replacement,
Applicability::Unspecified, // First resolve the TODO above Applicability::Unspecified, // First resolve the TODO above

View File

@ -102,9 +102,9 @@ const DROP_REF_SUMMARY: &str = "calls to `std::mem::drop` with a reference inste
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. \ 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. \ 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. \ 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]); declare_lint_pass!(DropForgetRef => [DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY]);
@ -137,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
expr.span, expr.span,
&msg, &msg,
arg.span, arg.span,
&format!("argument has type {}", arg_ty)); &format!("argument has type `{}`", arg_ty));
} else if is_copy(cx, arg_ty) { } else if is_copy(cx, arg_ty) {
if match_def_path(cx, def_id, &paths::DROP) { if match_def_path(cx, def_id, &paths::DROP) {
lint = DROP_COPY; lint = DROP_COPY;

View File

@ -43,7 +43,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub ELSE_IF_WITHOUT_ELSE, pub ELSE_IF_WITHOUT_ELSE,
restriction, restriction,
"if expression with an `else if`, but without a final `else` branch" "`if` expression with an `else if`, but without a final `else` branch"
} }
declare_lint_pass!(ElseIfWithoutElse => [ELSE_IF_WITHOUT_ELSE]); declare_lint_pass!(ElseIfWithoutElse => [ELSE_IF_WITHOUT_ELSE]);
@ -60,7 +60,7 @@ impl EarlyLintPass for ElseIfWithoutElse {
cx, cx,
ELSE_IF_WITHOUT_ELSE, ELSE_IF_WITHOUT_ELSE,
els.span, els.span,
"if expression with an `else if`, but without a final `else`", "`if` expression with an `else if`, but without a final `else`",
"add an `else` block here", "add an `else` block here",
); );
} }

View File

@ -46,9 +46,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UselessFormat {
// Operate on the only argument of `alloc::fmt::format`. // Operate on the only argument of `alloc::fmt::format`.
if let Some(sugg) = on_new_v1(cx, expr) { if let Some(sugg) = on_new_v1(cx, expr) {
span_useless_format(cx, span, "consider using .to_string()", sugg); span_useless_format(cx, span, "consider using `.to_string()`", sugg);
} else if let Some(sugg) = on_new_v1_fmt(cx, expr) { } else if let Some(sugg) = on_new_v1_fmt(cx, expr) {
span_useless_format(cx, span, "consider using .to_string()", sugg); span_useless_format(cx, span, "consider using `.to_string()`", sugg);
} }
} }
} }

View File

@ -61,7 +61,7 @@ impl EarlyLintPass for IfNotElse {
IF_NOT_ELSE, IF_NOT_ELSE,
item.span, item.span,
"Unnecessary boolean `not` operation", "Unnecessary boolean `not` operation",
"remove the `!` and swap the blocks of the if/else", "remove the `!` and swap the blocks of the `if`/`else`",
); );
}, },
ExprKind::Binary(ref kind, _, _) if kind.node == BinOpKind::Ne => { ExprKind::Binary(ref kind, _, _) if kind.node == BinOpKind::Ne => {
@ -70,7 +70,7 @@ impl EarlyLintPass for IfNotElse {
IF_NOT_ELSE, IF_NOT_ELSE,
item.span, item.span,
"Unnecessary `!=` operation", "Unnecessary `!=` operation",
"change to `==` and swap the blocks of the if/else", "change to `==` and swap the blocks of the `if`/`else`",
); );
}, },
_ => (), _ => (),

View File

@ -51,7 +51,7 @@ fn lint(cx: &LateContext<'_, '_>, outer_span: Span, inner_span: Span, msg: &str)
let outer_span = outer_span.source_callsite(); let outer_span = outer_span.source_callsite();
let inner_span = inner_span.source_callsite(); let inner_span = inner_span.source_callsite();
span_lint_and_then(cx, IMPLICIT_RETURN, outer_span, "missing return statement", |db| { span_lint_and_then(cx, IMPLICIT_RETURN, outer_span, "missing `return` statement", |db| {
if let Some(snippet) = snippet_opt(cx, inner_span) { if let Some(snippet) = snippet_opt(cx, inner_span) {
db.span_suggestion( db.span_suggestion(
outer_span, outer_span,
@ -102,7 +102,7 @@ fn expr_match(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
expr_match(cx, &arm.body); expr_match(cx, &arm.body);
} }
} else { } else {
expr_match(cx, &arms.first().expect("if let doesn't have a single arm").body); expr_match(cx, &arms.first().expect("`if let` doesn't have a single arm").body);
} }
}, },
// skip if it already has a return statement // skip if it already has a return statement

View File

@ -38,7 +38,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub INFALLIBLE_DESTRUCTURING_MATCH, pub INFALLIBLE_DESTRUCTURING_MATCH,
style, style,
"a match statement with a single infallible arm instead of a `let`" "a `match` statement with a single infallible arm instead of a `let`"
} }
declare_lint_pass!(InfallibleDestructingMatch => [INFALLIBLE_DESTRUCTURING_MATCH]); declare_lint_pass!(InfallibleDestructingMatch => [INFALLIBLE_DESTRUCTURING_MATCH]);
@ -61,7 +61,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InfallibleDestructingMatch {
cx, cx,
INFALLIBLE_DESTRUCTURING_MATCH, INFALLIBLE_DESTRUCTURING_MATCH,
local.span, local.span,
"you seem to be trying to use match to destructure a single infallible pattern. \ "you seem to be trying to use `match` to destructure a single infallible pattern. \
Consider using `let`", Consider using `let`",
"try this", "try this",
format!( format!(

View File

@ -88,7 +88,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub INHERENT_TO_STRING_SHADOW_DISPLAY, pub INHERENT_TO_STRING_SHADOW_DISPLAY,
correctness, correctness,
"type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait " "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait"
} }
declare_lint_pass!(InherentToString => [INHERENT_TO_STRING, INHERENT_TO_STRING_SHADOW_DISPLAY]); declare_lint_pass!(InherentToString => [INHERENT_TO_STRING, INHERENT_TO_STRING_SHADOW_DISPLAY]);

View File

@ -32,7 +32,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub INT_PLUS_ONE, pub INT_PLUS_ONE,
complexity, complexity,
"instead of using x >= y + 1, use x > y" "instead of using `x >= y + 1`, use `x > y`"
} }
declare_lint_pass!(IntPlusOne => [INT_PLUS_ONE]); declare_lint_pass!(IntPlusOne => [INT_PLUS_ONE]);

View File

@ -59,7 +59,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeStackArrays {
self.maximum_allowed_size self.maximum_allowed_size
), ),
&format!( &format!(
"consider allocating on the heap with vec!{}.into_boxed_slice()", "consider allocating on the heap with `vec!{}.into_boxed_slice()`",
snippet(cx, expr.span, "[...]") snippet(cx, expr.span, "[...]")
), ),
); );

View File

@ -27,7 +27,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub LET_UNDERSCORE_MUST_USE, pub LET_UNDERSCORE_MUST_USE,
restriction, restriction,
"non-binding let on a #[must_use] expression" "non-binding let on a `#[must_use]` expression"
} }
declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE]); declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE]);
@ -44,7 +44,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetUnderscore {
cx, cx,
LET_UNDERSCORE_MUST_USE, LET_UNDERSCORE_MUST_USE,
stmt.span, stmt.span,
"non-binding let on an expression with #[must_use] type", "non-binding let on an expression with `#[must_use]` type",
"consider explicitly using expression value" "consider explicitly using expression value"
) )
} else if is_must_use_func_call(cx, init) { } else if is_must_use_func_call(cx, init) {
@ -52,7 +52,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetUnderscore {
cx, cx,
LET_UNDERSCORE_MUST_USE, LET_UNDERSCORE_MUST_USE,
stmt.span, stmt.span,
"non-binding let on a result of a #[must_use] function", "non-binding let on a result of a `#[must_use]` function",
"consider explicitly using function result" "consider explicitly using function result"
) )
} }

View File

@ -1353,7 +1353,7 @@ fn check_for_loop_arg(cx: &LateContext<'_, '_>, pat: &Pat<'_>, arg: &Expr<'_>, e
EXPLICIT_INTO_ITER_LOOP, EXPLICIT_INTO_ITER_LOOP,
arg.span, arg.span,
"it is more concise to loop over containers instead of using explicit \ "it is more concise to loop over containers instead of using explicit \
iteration methods`", iteration methods",
"to write this more concisely, try", "to write this more concisely, try",
object.to_string(), object.to_string(),
applicability, applicability,

View File

@ -112,7 +112,7 @@ fn lint_needless_cloning(cx: &LateContext<'_, '_>, root: Span, receiver: Span) {
MAP_CLONE, MAP_CLONE,
root.trim_start(receiver).unwrap(), root.trim_start(receiver).unwrap(),
"You are needlessly cloning iterator elements", "You are needlessly cloning iterator elements",
"Remove the map call", "Remove the `map` call",
String::new(), String::new(),
Applicability::MachineApplicable, Applicability::MachineApplicable,
) )

View File

@ -48,7 +48,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub OPTION_MAP_UNIT_FN, pub OPTION_MAP_UNIT_FN,
complexity, complexity,
"using `option.map(f)`, where f is a function or closure that returns ()" "using `option.map(f)`, where `f` is a function or closure that returns `()`"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -89,7 +89,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub RESULT_MAP_UNIT_FN, pub RESULT_MAP_UNIT_FN,
complexity, complexity,
"using `result.map(f)`, where f is a function or closure that returns ()" "using `result.map(f)`, where `f` is a function or closure that returns `()`"
} }
declare_lint_pass!(MapUnit => [OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN]); declare_lint_pass!(MapUnit => [OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN]);
@ -199,7 +199,7 @@ fn let_binding_name(cx: &LateContext<'_, '_>, var_arg: &hir::Expr<'_>) -> String
#[must_use] #[must_use]
fn suggestion_msg(function_type: &str, map_type: &str) -> String { fn suggestion_msg(function_type: &str, map_type: &str) -> String {
format!( format!(
"called `map(f)` on an {0} value where `f` is a unit {1}", "called `map(f)` on an `{0}` value where `f` is a unit {1}",
map_type, function_type map_type, function_type
) )
} }

View File

@ -37,7 +37,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub SINGLE_MATCH, pub SINGLE_MATCH,
style, style,
"a match statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`" "a `match` statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -76,7 +76,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub SINGLE_MATCH_ELSE, pub SINGLE_MATCH_ELSE,
pedantic, pedantic,
"a match statement with two arms where the second arm's pattern is a placeholder instead of a specific match pattern" "a `match` statement with two arms where the second arm's pattern is a placeholder instead of a specific match pattern"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -99,7 +99,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MATCH_REF_PATS, pub MATCH_REF_PATS,
style, style,
"a match or `if let` with all arms prefixed with `&` instead of deref-ing the match expression" "a `match` or `if let` with all arms prefixed with `&` instead of deref-ing the match expression"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -133,7 +133,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MATCH_BOOL, pub MATCH_BOOL,
style, style,
"a match on a boolean expression instead of an `if..else` block" "a `match` on a boolean expression instead of an `if..else` block"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -155,7 +155,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MATCH_OVERLAPPING_ARM, pub MATCH_OVERLAPPING_ARM,
style, style,
"a match with overlapping arms" "a `match` with overlapping arms"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -177,7 +177,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MATCH_WILD_ERR_ARM, pub MATCH_WILD_ERR_ARM,
style, style,
"a match with `Err(_)` arm and take drastic actions" "a `match` with `Err(_)` arm and take drastic actions"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -198,7 +198,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MATCH_AS_REF, pub MATCH_AS_REF,
complexity, complexity,
"a match on an Option value instead of using `as_ref()` or `as_mut`" "a `match` on an Option value instead of using `as_ref()` or `as_mut`"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -407,7 +407,7 @@ fn check_match_bool(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>], e
if let Some(sugg) = sugg { if let Some(sugg) = sugg {
db.span_suggestion( db.span_suggestion(
expr.span, expr.span,
"consider using an if/else expression", "consider using an `if`/`else` expression",
sugg, sugg,
Applicability::HasPlaceholders, Applicability::HasPlaceholders,
); );
@ -461,10 +461,10 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>])
span_note_and_lint(cx, span_note_and_lint(cx,
MATCH_WILD_ERR_ARM, MATCH_WILD_ERR_ARM,
arm.pat.span, arm.pat.span,
"Err(_) will match all errors, maybe not a good idea", "`Err(_)` will match all errors, maybe not a good idea",
arm.pat.span, arm.pat.span,
"to remove this warning, match each error separately \ "to remove this warning, match each error separately \
or use unreachable macro"); or use `unreachable!` macro");
} }
} }
} }
@ -650,7 +650,7 @@ fn check_match_as_ref(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>],
cx, cx,
MATCH_AS_REF, MATCH_AS_REF,
expr.span, expr.span,
&format!("use {}() instead", suggestion), &format!("use `{}()` instead", suggestion),
"try this", "try this",
format!( format!(
"{}.{}(){}", "{}.{}(){}",

View File

@ -25,7 +25,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MEM_DISCRIMINANT_NON_ENUM, pub MEM_DISCRIMINANT_NON_ENUM,
correctness, correctness,
"calling mem::descriminant on non-enum type" "calling `mem::descriminant` on non-enum type"
} }
declare_lint_pass!(MemDiscriminant => [MEM_DISCRIMINANT_NON_ENUM]); declare_lint_pass!(MemDiscriminant => [MEM_DISCRIMINANT_NON_ENUM]);

View File

@ -35,7 +35,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget {
let forgot_ty = cx.tables.expr_ty(&args[0]); let forgot_ty = cx.tables.expr_ty(&args[0]);
if forgot_ty.ty_adt_def().map_or(false, |def| def.has_dtor(cx.tcx)) { if forgot_ty.ty_adt_def().map_or(false, |def| def.has_dtor(cx.tcx)) {
span_lint(cx, MEM_FORGET, e.span, "usage of mem::forget on Drop type"); span_lint(cx, MEM_FORGET, e.span, "usage of `mem::forget` on `Drop` type");
} }
} }
} }

View File

@ -1828,7 +1828,7 @@ fn lint_clone_on_ref_ptr(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, arg: &h
cx, cx,
CLONE_ON_REF_PTR, CLONE_ON_REF_PTR,
expr.span, expr.span,
"using '.clone()' on a ref-counted pointer", "using `.clone()` on a ref-counted pointer",
"try this", "try this",
format!( format!(
"{}::<{}>::clone(&{})", "{}::<{}>::clone(&{})",
@ -2220,8 +2220,8 @@ fn lint_unwrap(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, unwrap_args: &[hi
lint, lint,
expr.span, expr.span,
&format!( &format!(
"used unwrap() on {} value. If you don't want to handle the {} case gracefully, consider \ "used `unwrap()` on `{}` value. If you don't want to handle the `{}` case gracefully, consider \
using expect() to provide a better panic \ using `expect()` to provide a better panic \
message", message",
kind, none_value kind, none_value
), ),
@ -2247,7 +2247,7 @@ fn lint_expect(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, expect_args: &[hi
lint, lint,
expr.span, expr.span,
&format!( &format!(
"used expect() on {} value. If this value is an {} it will panic", "used `expect()` on `{}` value. If this value is an `{}` it will panic",
kind, none_value kind, none_value
), ),
); );
@ -2268,7 +2268,7 @@ fn lint_ok_expect(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, ok_args: &[hir
cx, cx,
OK_EXPECT, OK_EXPECT,
expr.span, expr.span,
"called `ok().expect()` on a Result value. You can call `expect` directly on the `Result`", "called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`",
); );
} }
} }
@ -2286,7 +2286,7 @@ fn lint_map_flatten<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr<
span_lint_and_then(cx, MAP_FLATTEN, expr.span, msg, |db| { span_lint_and_then(cx, MAP_FLATTEN, expr.span, msg, |db| {
db.span_suggestion( db.span_suggestion(
expr.span, expr.span,
"try using flat_map instead", "try using `flat_map` instead",
hint, hint,
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -2320,10 +2320,10 @@ fn lint_map_unwrap_or_else<'a, 'tcx>(
// lint message // lint message
let msg = if is_option { let msg = if is_option {
"called `map(f).unwrap_or_else(g)` on an Option value. This can be done more directly by calling \ "called `map(f).unwrap_or_else(g)` on an `Option` value. This can be done more directly by calling \
`map_or_else(g, f)` instead" `map_or_else(g, f)` instead"
} else { } else {
"called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling \ "called `map(f).unwrap_or_else(g)` on a `Result` value. This can be done more directly by calling \
`.map_or_else(g, f)` instead" `.map_or_else(g, f)` instead"
}; };
// get snippets for args to map() and unwrap_or_else() // get snippets for args to map() and unwrap_or_else()
@ -2380,7 +2380,7 @@ fn lint_map_or_none<'a, 'tcx>(
if map_or_arg_is_none { if map_or_arg_is_none {
// lint message // lint message
let msg = "called `map_or(None, f)` on an Option value. This can be done more directly by calling \ let msg = "called `map_or(None, f)` on an `Option` value. This can be done more directly by calling \
`and_then(f)` instead"; `and_then(f)` instead";
let map_or_self_snippet = snippet(cx, map_or_args[0].span, ".."); let map_or_self_snippet = snippet(cx, map_or_args[0].span, "..");
let map_or_func_snippet = snippet(cx, map_or_args[2].span, ".."); let map_or_func_snippet = snippet(cx, map_or_args[2].span, "..");
@ -2388,7 +2388,7 @@ fn lint_map_or_none<'a, 'tcx>(
span_lint_and_then(cx, OPTION_MAP_OR_NONE, expr.span, msg, |db| { span_lint_and_then(cx, OPTION_MAP_OR_NONE, expr.span, msg, |db| {
db.span_suggestion( db.span_suggestion(
expr.span, expr.span,
"try using and_then instead", "try using `and_then` instead",
hint, hint,
Applicability::MachineApplicable, // snippet Applicability::MachineApplicable, // snippet
); );
@ -2860,7 +2860,7 @@ fn lint_single_char_pattern<'a, 'tcx>(
SINGLE_CHAR_PATTERN, SINGLE_CHAR_PATTERN,
arg.span, arg.span,
"single-character string constant used as pattern", "single-character string constant used as pattern",
"try using a char instead", "try using a `char` instead",
hint, hint,
applicability, applicability,
); );
@ -2928,7 +2928,7 @@ fn lint_into_iter(cx: &LateContext<'_, '_>, expr: &hir::Expr<'_>, self_ref_ty: T
INTO_ITER_ON_REF, INTO_ITER_ON_REF,
method_span, method_span,
&format!( &format!(
"this .into_iter() call is equivalent to .{}() and will not move the {}", "this `.into_iter()` call is equivalent to `.{}()` and will not move the `{}`",
method_name, kind, method_name, kind,
), ),
"call directly", "call directly",

View File

@ -60,7 +60,7 @@ pub(super) fn lint<'a, 'tcx>(
"map_or(a, f)" "map_or(a, f)"
}; };
let msg = &format!( let msg = &format!(
"called `map(f).unwrap_or({})` on an Option value. \ "called `map(f).unwrap_or({})` on an `Option` value. \
This can be done more directly by calling `{}` instead", This can be done more directly by calling `{}` instead",
arg, suggest arg, suggest
); );

View File

@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MinMaxPass {
cx, cx,
MIN_MAX, MIN_MAX,
expr.span, expr.span,
"this min/max combination leads to constant result", "this `min`/`max` combination leads to constant result",
); );
}, },
} }

View File

@ -63,7 +63,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub CMP_NAN, pub CMP_NAN,
correctness, correctness,
"comparisons to NAN, which will always return false, probably not intended" "comparisons to `NAN`, which will always return false, probably not intended"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -194,7 +194,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub ZERO_PTR, pub ZERO_PTR,
style, style,
"using 0 as *{const, mut} T" "using `0 as *{const, mut} T`"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -370,9 +370,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
} }
} }
let (lint, msg) = if is_named_constant(cx, left) || is_named_constant(cx, right) { let (lint, msg) = if is_named_constant(cx, left) || is_named_constant(cx, right) {
(FLOAT_CMP_CONST, "strict comparison of f32 or f64 constant") (FLOAT_CMP_CONST, "strict comparison of `f32` or `f64` constant")
} else { } else {
(FLOAT_CMP, "strict comparison of f32 or f64") (FLOAT_CMP, "strict comparison of `f32` or `f64`")
}; };
span_lint_and_then(cx, lint, expr.span, msg, |db| { span_lint_and_then(cx, lint, expr.span, msg, |db| {
let lhs = Sugg::hir(cx, left, ".."); let lhs = Sugg::hir(cx, left, "..");
@ -388,7 +388,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
), ),
Applicability::HasPlaceholders, // snippet Applicability::HasPlaceholders, // snippet
); );
db.span_note(expr.span, "std::f32::EPSILON and std::f64::EPSILON are available."); db.span_note(expr.span, "`std::f32::EPSILON` and `std::f64::EPSILON` are available.");
}); });
} else if op == BinOpKind::Rem && is_integer_const(cx, right, 1) { } else if op == BinOpKind::Rem && is_integer_const(cx, right, 1) {
span_lint(cx, MODULO_ONE, expr.span, "any number modulo 1 will be 0"); span_lint(cx, MODULO_ONE, expr.span, "any number modulo 1 will be 0");
@ -456,7 +456,7 @@ fn check_nan(cx: &LateContext<'_, '_>, expr: &Expr<'_>, cmp_expr: &Expr<'_>) {
cx, cx,
CMP_NAN, CMP_NAN,
cmp_expr.span, cmp_expr.span,
"doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead", "doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead",
); );
} }
} }

View File

@ -113,7 +113,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
cx.tcx.sess.span_err(span, &err); cx.tcx.sess.span_err(span, &err);
} }
} else { } else {
span_lint(cx, MISSING_CONST_FOR_FN, span, "this could be a const_fn"); span_lint(cx, MISSING_CONST_FOR_FN, span, "this could be a `const fn`");
} }
} }
} }

View File

@ -54,7 +54,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MISSING_INLINE_IN_PUBLIC_ITEMS, pub MISSING_INLINE_IN_PUBLIC_ITEMS,
restriction, restriction,
"detects missing #[inline] attribute for public callables (functions, trait methods, methods...)" "detects missing `#[inline]` attribute for public callables (functions, trait methods, methods...)"
} }
fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute], sp: Span, desc: &'static str) { fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute], sp: Span, desc: &'static str) {

View File

@ -75,7 +75,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MulAddCheck {
cx, cx,
MANUAL_MUL_ADD, MANUAL_MUL_ADD,
expr.span, expr.span,
"consider using mul_add() for better numerical precision", "consider using `mul_add()` for better numerical precision",
"try", "try",
format!( format!(
"{}.mul_add({}, {})", "{}.mul_add({}, {})",
@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MulAddCheck {
cx, cx,
MANUAL_MUL_ADD, MANUAL_MUL_ADD,
expr.span, expr.span,
"consider using mul_add() for better numerical precision", "consider using `mul_add()` for better numerical precision",
"try", "try",
format!( format!(
"{}.mul_add({}, {})", "{}.mul_add({}, {})",

View File

@ -47,7 +47,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub MUTABLE_KEY_TYPE, pub MUTABLE_KEY_TYPE,
correctness, correctness,
"Check for mutable Map/Set key type" "Check for mutable `Map`/`Set` key type"
} }
declare_lint_pass!(MutableKeyType => [ MUTABLE_KEY_TYPE ]); declare_lint_pass!(MutableKeyType => [ MUTABLE_KEY_TYPE ]);

View File

@ -63,8 +63,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Mutex {
let mutex_param = subst.type_at(0); let mutex_param = subst.type_at(0);
if let Some(atomic_name) = get_atomic_name(mutex_param) { if let Some(atomic_name) = get_atomic_name(mutex_param) {
let msg = format!( let msg = format!(
"Consider using an {} instead of a Mutex here. If you just want the locking \ "Consider using an `{}` instead of a `Mutex` here. If you just want the locking \
behaviour and not the internal type, consider using Mutex<()>.", behavior and not the internal type, consider using `Mutex<()>`.",
atomic_name atomic_name
); );
match mutex_param.kind { match mutex_param.kind {

View File

@ -113,7 +113,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool {
_ => (), _ => (),
} }
} else { } else {
panic!("IfExpr 'then' node is not an ExprKind::Block"); panic!("IfExpr `then` node is not an `ExprKind::Block`");
} }
} }
} }

View File

@ -274,15 +274,15 @@ struct LintData<'a> {
block_stmts: &'a [ast::Stmt], block_stmts: &'a [ast::Stmt],
} }
const MSG_REDUNDANT_ELSE_BLOCK: &str = "This else block is redundant.\n"; const MSG_REDUNDANT_ELSE_BLOCK: &str = "This `else` block is redundant.\n";
const MSG_ELSE_BLOCK_NOT_NEEDED: &str = "There is no need for an explicit `else` block for this `if` \ const MSG_ELSE_BLOCK_NOT_NEEDED: &str = "There is no need for an explicit `else` block for this `if` \
expression\n"; expression\n";
const DROP_ELSE_BLOCK_AND_MERGE_MSG: &str = "Consider dropping the else clause and merging the code that \ const DROP_ELSE_BLOCK_AND_MERGE_MSG: &str = "Consider dropping the `else` clause and merging the code that \
follows (in the loop) with the if block, like so:\n"; follows (in the loop) with the `if` block, like so:\n";
const DROP_ELSE_BLOCK_MSG: &str = "Consider dropping the else clause, and moving out the code in the else \ const DROP_ELSE_BLOCK_MSG: &str = "Consider dropping the `else` clause, and moving out the code in the `else` \
block, like so:\n"; block, like so:\n";
fn emit_warning<'a>(ctx: &EarlyContext<'_>, data: &'a LintData<'_>, header: &str, typ: LintType) { fn emit_warning<'a>(ctx: &EarlyContext<'_>, data: &'a LintData<'_>, header: &str, typ: LintType) {

View File

@ -206,7 +206,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
if let ty::Adt(def, ..) = ty.kind { if let ty::Adt(def, ..) = ty.kind {
if let Some(span) = cx.tcx.hir().span_if_local(def.did) { if let Some(span) = cx.tcx.hir().span_if_local(def.did) {
if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() { if cx.param_env.can_type_implement_copy(cx.tcx, ty).is_ok() {
db.span_help(span, "consider marking this type as Copy"); db.span_help(span, "consider marking this type as `Copy`");
} }
} }
} }

View File

@ -21,7 +21,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub NEG_MULTIPLY, pub NEG_MULTIPLY,
style, style,
"multiplying integers with -1" "multiplying integers with `-1`"
} }
declare_lint_pass!(NegMultiply => [NEG_MULTIPLY]); declare_lint_pass!(NegMultiply => [NEG_MULTIPLY]);
@ -48,7 +48,7 @@ fn check_mul(cx: &LateContext<'_, '_>, span: Span, lit: &Expr<'_>, exp: &Expr<'_
if let Constant::Int(1) = consts::lit_to_constant(&l.node, cx.tables.expr_ty_opt(lit)); if let Constant::Int(1) = consts::lit_to_constant(&l.node, cx.tables.expr_ty_opt(lit));
if cx.tables.expr_ty(exp).is_integral(); if cx.tables.expr_ty(exp).is_integral();
then { then {
span_lint(cx, NEG_MULTIPLY, span, "Negation by multiplying with -1"); span_lint(cx, NEG_MULTIPLY, span, "Negation by multiplying with `-1`");
} }
} }
} }

View File

@ -49,7 +49,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub DECLARE_INTERIOR_MUTABLE_CONST, pub DECLARE_INTERIOR_MUTABLE_CONST,
correctness, correctness,
"declaring const with interior mutability" "declaring `const` with interior mutability"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -81,7 +81,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub BORROW_INTERIOR_MUTABLE_CONST, pub BORROW_INTERIOR_MUTABLE_CONST,
correctness, correctness,
"referencing const with interior mutability" "referencing `const` with interior mutability"
} }
#[allow(dead_code)] #[allow(dead_code)]
@ -98,12 +98,12 @@ impl Source {
match self { match self {
Self::Item { item } | Self::Assoc { item, .. } => ( Self::Item { item } | Self::Assoc { item, .. } => (
DECLARE_INTERIOR_MUTABLE_CONST, DECLARE_INTERIOR_MUTABLE_CONST,
"a const item should never be interior mutable", "a `const` item should never be interior mutable",
*item, *item,
), ),
Self::Expr { expr } => ( Self::Expr { expr } => (
BORROW_INTERIOR_MUTABLE_CONST, BORROW_INTERIOR_MUTABLE_CONST,
"a const item with interior mutability should not be borrowed", "a `const` item with interior mutability should not be borrowed",
*expr, *expr,
), ),
} }

View File

@ -123,7 +123,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"the method \"create\" is called more than once", "the method `create` is called more than once",
); );
} else { } else {
create = true create = true
@ -136,7 +136,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"the method \"append\" is called more than once", "the method `append` is called more than once",
); );
} else { } else {
append = true append = true
@ -149,7 +149,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"the method \"truncate\" is called more than once", "the method `truncate` is called more than once",
); );
} else { } else {
truncate = true truncate = true
@ -162,7 +162,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"the method \"read\" is called more than once", "the method `read` is called more than once",
); );
} else { } else {
read = true read = true
@ -175,7 +175,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"the method \"write\" is called more than once", "the method `write` is called more than once",
); );
} else { } else {
write = true write = true
@ -190,7 +190,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"file opened with \"truncate\" and \"read\"", "file opened with `truncate` and `read`",
); );
} }
if append && truncate && append_arg && truncate_arg { if append && truncate && append_arg && truncate_arg {
@ -198,7 +198,7 @@ fn check_open_options(cx: &LateContext<'_, '_>, options: &[(OpenOption, Argument
cx, cx,
NONSENSICAL_OPEN_OPTIONS, NONSENSICAL_OPEN_OPTIONS,
span, span,
"file opened with \"append\" and \"truncate\"", "file opened with `append` and `truncate`",
); );
} }
} }

View File

@ -137,7 +137,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ptr {
cx, cx,
CMP_NULL, CMP_NULL,
expr.span, expr.span,
"Comparing with null is better expressed by the .is_null() method", "Comparing with null is better expressed by the `.is_null()` method",
); );
} }
} }

View File

@ -112,7 +112,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Ranges {
span_lint(cx, span_lint(cx,
RANGE_ZIP_WITH_LEN, RANGE_ZIP_WITH_LEN,
expr.span, expr.span,
&format!("It is more idiomatic to use {}.iter().enumerate()", &format!("It is more idiomatic to use `{}.iter().enumerate()`",
snippet(cx, iter_args[0].span, "_"))); snippet(cx, iter_args[0].span, "_")));
} }
} }

View File

@ -154,7 +154,7 @@ impl Return {
return; return;
} }
span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded `return` statement", |db| {
if let Some(snippet) = snippet_opt(cx, inner_span) { if let Some(snippet) = snippet_opt(cx, inner_span) {
db.span_suggestion(ret_span, "remove `return`", snippet, Applicability::MachineApplicable); db.span_suggestion(ret_span, "remove `return`", snippet, Applicability::MachineApplicable);
} }
@ -162,7 +162,7 @@ impl Return {
}, },
None => match replacement { None => match replacement {
RetReplacement::Empty => { RetReplacement::Empty => {
span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded `return` statement", |db| {
db.span_suggestion( db.span_suggestion(
ret_span, ret_span,
"remove `return`", "remove `return`",
@ -172,7 +172,7 @@ impl Return {
}); });
}, },
RetReplacement::Block => { RetReplacement::Block => {
span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded `return` statement", |db| {
db.span_suggestion( db.span_suggestion(
ret_span, ret_span,
"replace `return` with an empty block", "replace `return` with an empty block",
@ -211,9 +211,9 @@ impl Return {
cx, cx,
LET_AND_RETURN, LET_AND_RETURN,
retexpr.span, retexpr.span,
"returning the result of a let binding from a block", "returning the result of a `let` binding from a block",
|err| { |err| {
err.span_label(local.span, "unnecessary let binding"); err.span_label(local.span, "unnecessary `let` binding");
if let Some(snippet) = snippet_opt(cx, initexpr.span) { if let Some(snippet) = snippet_opt(cx, initexpr.span) {
err.multipart_suggestion( err.multipart_suggestion(

View File

@ -36,7 +36,7 @@ declare_clippy_lint! {
/// ``` /// ```
/// ///
/// Will be converted to: /// Will be converted to:
/// ```rust /// ```rust
/// /// /// ///
/// /// Struct to hold two strings: /// /// Struct to hold two strings:
/// /// - first one /// /// - first one

View File

@ -141,7 +141,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub LINKEDLIST, pub LINKEDLIST,
pedantic, pedantic,
"usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque" "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a `VecDeque`"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -316,7 +316,7 @@ fn check_ty(cx: &LateContext<'_, '_>, hir_ty: &hir::Ty<'_>, is_local: bool) {
LINKEDLIST, LINKEDLIST,
hir_ty.span, hir_ty.span,
"I see you're using a LinkedList! Perhaps you meant some other data structure?", "I see you're using a LinkedList! Perhaps you meant some other data structure?",
"a VecDeque might work", "a `VecDeque` might work",
); );
return; // don't recurse into the type return; // don't recurse into the type
} }
@ -464,7 +464,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub LET_UNIT_VALUE, pub LET_UNIT_VALUE,
style, style,
"creating a let binding to a value of unit type, which usually can't be used afterwards" "creating a `let` binding to a value of unit type, which usually can't be used afterwards"
} }
declare_lint_pass!(LetUnitValue => [LET_UNIT_VALUE]); declare_lint_pass!(LetUnitValue => [LET_UNIT_VALUE]);
@ -998,7 +998,7 @@ fn span_lossless_lint(cx: &LateContext<'_, '_>, expr: &Expr<'_>, op: &Expr<'_>,
CAST_LOSSLESS, CAST_LOSSLESS,
expr.span, expr.span,
&format!( &format!(
"casting {} to {} may become silently lossy if you later change the type", "casting `{}` to `{}` may become silently lossy if you later change the type",
cast_from, cast_to cast_from, cast_to
), ),
"try", "try",
@ -1053,7 +1053,10 @@ fn check_loss_of_sign(cx: &LateContext<'_, '_>, expr: &Expr<'_>, op: &Expr<'_>,
cx, cx,
CAST_SIGN_LOSS, CAST_SIGN_LOSS,
expr.span, expr.span,
&format!("casting {} to {} may lose the sign of the value", cast_from, cast_to), &format!(
"casting `{}` to `{}` may lose the sign of the value",
cast_from, cast_to
),
); );
} }
@ -1098,7 +1101,7 @@ fn check_truncation_and_wrapping(cx: &LateContext<'_, '_>, expr: &Expr<'_>, cast
CAST_POSSIBLE_TRUNCATION, CAST_POSSIBLE_TRUNCATION,
expr.span, expr.span,
&format!( &format!(
"casting {} to {} may truncate the value{}", "casting `{}` to `{}` may truncate the value{}",
cast_from, cast_from,
cast_to, cast_to,
match suffix_truncation { match suffix_truncation {
@ -1115,7 +1118,7 @@ fn check_truncation_and_wrapping(cx: &LateContext<'_, '_>, expr: &Expr<'_>, cast
CAST_POSSIBLE_WRAP, CAST_POSSIBLE_WRAP,
expr.span, expr.span,
&format!( &format!(
"casting {} to {} may wrap around the value{}", "casting `{}` to `{}` may wrap around the value{}",
cast_from, cast_from,
cast_to, cast_to,
match suffix_wrap { match suffix_wrap {
@ -1194,7 +1197,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Casts {
cx, cx,
UNNECESSARY_CAST, UNNECESSARY_CAST,
expr.span, expr.span,
&format!("casting integer literal to {} is unnecessary", cast_to), &format!("casting integer literal to `{}` is unnecessary", cast_to),
"try", "try",
format!("{}_{}", n, cast_to), format!("{}_{}", n, cast_to),
Applicability::MachineApplicable, Applicability::MachineApplicable,
@ -1256,14 +1259,17 @@ fn lint_numeric_casts<'tcx>(
cx, cx,
CAST_POSSIBLE_TRUNCATION, CAST_POSSIBLE_TRUNCATION,
expr.span, expr.span,
&format!("casting {} to {} may truncate the value", cast_from, cast_to), &format!("casting `{}` to `{}` may truncate the value", cast_from, cast_to),
); );
if !cast_to.is_signed() { if !cast_to.is_signed() {
span_lint( span_lint(
cx, cx,
CAST_SIGN_LOSS, CAST_SIGN_LOSS,
expr.span, expr.span,
&format!("casting {} to {} may lose the sign of the value", cast_from, cast_to), &format!(
"casting `{}` to `{}` may lose the sign of the value",
cast_from, cast_to
),
); );
} }
}, },
@ -1278,7 +1284,7 @@ fn lint_numeric_casts<'tcx>(
cx, cx,
CAST_POSSIBLE_TRUNCATION, CAST_POSSIBLE_TRUNCATION,
expr.span, expr.span,
"casting f64 to f32 may truncate the value", "casting `f64` to `f32` may truncate the value",
); );
} }
if let (&ty::Float(FloatTy::F32), &ty::Float(FloatTy::F64)) = (&cast_from.kind, &cast_to.kind) { if let (&ty::Float(FloatTy::F32), &ty::Float(FloatTy::F64)) = (&cast_from.kind, &cast_to.kind) {
@ -1550,7 +1556,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub CHAR_LIT_AS_U8, pub CHAR_LIT_AS_U8,
complexity, complexity,
"casting a character literal to u8 truncates" "casting a character literal to `u8` truncates"
} }
declare_lint_pass!(CharLitAsU8 => [CHAR_LIT_AS_U8]); declare_lint_pass!(CharLitAsU8 => [CHAR_LIT_AS_U8]);
@ -1742,7 +1748,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons {
AlwaysFalse => "this comparison is always false".to_owned(), AlwaysFalse => "this comparison is always false".to_owned(),
AlwaysTrue => "this comparison is always true".to_owned(), AlwaysTrue => "this comparison is always true".to_owned(),
InequalityImpossible => format!( InequalityImpossible => format!(
"the case where the two sides are not equal never occurs, consider using {} == {} \ "the case where the two sides are not equal never occurs, consider using `{} == {}` \
instead", instead",
snippet(cx, lhs.span, "lhs"), snippet(cx, lhs.span, "lhs"),
snippet(cx, rhs.span, "rhs") snippet(cx, rhs.span, "rhs")
@ -1750,7 +1756,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons {
}; };
let help = format!( let help = format!(
"because {} is the {} value for this type, {}", "because `{}` is the {} value for this type, {}",
snippet(cx, culprit.expr.span, "x"), snippet(cx, culprit.expr.span, "x"),
match culprit.which { match culprit.which {
Minimum => "minimum", Minimum => "minimum",
@ -1813,7 +1819,7 @@ impl FullInt {
impl PartialEq for FullInt { impl PartialEq for FullInt {
#[must_use] #[must_use]
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
self.partial_cmp(other).expect("partial_cmp only returns Some(_)") == Ordering::Equal self.partial_cmp(other).expect("`partial_cmp` only returns `Some(_)`") == Ordering::Equal
} }
} }
@ -1832,7 +1838,7 @@ impl Ord for FullInt {
#[must_use] #[must_use]
fn cmp(&self, other: &Self) -> Ordering { fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other) self.partial_cmp(other)
.expect("partial_cmp for FullInt can never return None") .expect("`partial_cmp` for FullInt can never return `None`")
} }
} }
@ -2404,7 +2410,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RefToMut {
cx, cx,
CAST_REF_TO_MUT, CAST_REF_TO_MUT,
expr.span, expr.span,
"casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell", "casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`",
); );
} }
} }

View File

@ -66,7 +66,7 @@ fn unsafe_to_safe_check(old_name: Ident, new_name: Ident, cx: &EarlyContext<'_>,
UNSAFE_REMOVED_FROM_NAME, UNSAFE_REMOVED_FROM_NAME,
span, span,
&format!( &format!(
"removed \"unsafe\" from the name of `{}` in use as `{}`", "removed `unsafe` from the name of `{}` in use as `{}`",
old_str, new_str old_str, new_str
), ),
); );

View File

@ -35,7 +35,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub UNNECESSARY_UNWRAP, pub UNNECESSARY_UNWRAP,
complexity, complexity,
"checks for calls of unwrap[_err]() that cannot fail" "checks for calls of `unwrap[_err]()` that cannot fail"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -58,7 +58,7 @@ declare_clippy_lint! {
/// This code will always panic. The if condition should probably be inverted. /// This code will always panic. The if condition should probably be inverted.
pub PANICKING_UNWRAP, pub PANICKING_UNWRAP,
correctness, correctness,
"checks for calls of unwrap[_err]() that will always fail" "checks for calls of `unwrap[_err]()` that will always fail"
} }
/// Visitor that keeps track of which variables are unwrappable. /// Visitor that keeps track of which variables are unwrappable.

View File

@ -20,7 +20,7 @@ declare_clippy_lint! {
/// ``` /// ```
pub ZERO_DIVIDED_BY_ZERO, pub ZERO_DIVIDED_BY_ZERO,
complexity, complexity,
"usage of `0.0 / 0.0` to obtain NaN instead of std::f32::NaN or std::f64::NaN" "usage of `0.0 / 0.0` to obtain NaN instead of `std::f32::NAN` or `std::f64::NAN`"
} }
declare_lint_pass!(ZeroDiv => [ZERO_DIVIDED_BY_ZERO]); declare_lint_pass!(ZeroDiv => [ZERO_DIVIDED_BY_ZERO]);
@ -50,7 +50,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ZeroDiv {
cx, cx,
ZERO_DIVIDED_BY_ZERO, ZERO_DIVIDED_BY_ZERO,
expr.span, expr.span,
"constant division of 0.0 with 0.0 will always result in NaN", "constant division of `0.0` with `0.0` will always result in NaN",
&format!( &format!(
"Consider using `std::{}::NAN` if you would like a constant representing NaN", "Consider using `std::{}::NAN` if you would like a constant representing NaN",
float_type, float_type,

View File

@ -87,7 +87,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "borrow_interior_mutable_const", name: "borrow_interior_mutable_const",
group: "correctness", group: "correctness",
desc: "referencing const with interior mutability", desc: "referencing `const` with interior mutability",
deprecation: None, deprecation: None,
module: "non_copy_const", module: "non_copy_const",
}, },
@ -178,7 +178,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "char_lit_as_u8", name: "char_lit_as_u8",
group: "complexity", group: "complexity",
desc: "casting a character literal to u8 truncates", desc: "casting a character literal to `u8` truncates",
deprecation: None, deprecation: None,
module: "types", module: "types",
}, },
@ -227,7 +227,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "cmp_nan", name: "cmp_nan",
group: "correctness", group: "correctness",
desc: "comparisons to NAN, which will always return false, probably not intended", desc: "comparisons to `NAN`, which will always return false, probably not intended",
deprecation: None, deprecation: None,
module: "misc", module: "misc",
}, },
@ -304,21 +304,21 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "declare_interior_mutable_const", name: "declare_interior_mutable_const",
group: "correctness", group: "correctness",
desc: "declaring const with interior mutability", desc: "declaring `const` with interior mutability",
deprecation: None, deprecation: None,
module: "non_copy_const", module: "non_copy_const",
}, },
Lint { Lint {
name: "default_trait_access", name: "default_trait_access",
group: "pedantic", group: "pedantic",
desc: "checks for literal calls to Default::default()", desc: "checks for literal calls to `Default::default()`",
deprecation: None, deprecation: None,
module: "default_trait_access", module: "default_trait_access",
}, },
Lint { Lint {
name: "deprecated_cfg_attr", name: "deprecated_cfg_attr",
group: "complexity", group: "complexity",
desc: "usage of `cfg_attr(rustfmt)` instead of `tool_attributes`", desc: "usage of `cfg_attr(rustfmt)` instead of tool attributes",
deprecation: None, deprecation: None,
module: "attrs", module: "attrs",
}, },
@ -423,7 +423,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "else_if_without_else", name: "else_if_without_else",
group: "restriction", group: "restriction",
desc: "if expression with an `else if`, but without a final `else` branch", desc: "`if` expression with an `else if`, but without a final `else` branch",
deprecation: None, deprecation: None,
module: "else_if_without_else", module: "else_if_without_else",
}, },
@ -710,14 +710,14 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "if_same_then_else", name: "if_same_then_else",
group: "correctness", group: "correctness",
desc: "if with the same *then* and *else* blocks", desc: "`if` with the same `then` and `else` blocks",
deprecation: None, deprecation: None,
module: "copies", module: "copies",
}, },
Lint { Lint {
name: "ifs_same_cond", name: "ifs_same_cond",
group: "correctness", group: "correctness",
desc: "consecutive `ifs` with the same condition", desc: "consecutive `if`s with the same condition",
deprecation: None, deprecation: None,
module: "copies", module: "copies",
}, },
@ -766,7 +766,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "infallible_destructuring_match", name: "infallible_destructuring_match",
group: "style", group: "style",
desc: "a match statement with a single infallible arm instead of a `let`", desc: "a `match` statement with a single infallible arm instead of a `let`",
deprecation: None, deprecation: None,
module: "infallible_destructuring_match", module: "infallible_destructuring_match",
}, },
@ -787,7 +787,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "inherent_to_string_shadow_display", name: "inherent_to_string_shadow_display",
group: "correctness", group: "correctness",
desc: "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait ", desc: "type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait",
deprecation: None, deprecation: None,
module: "inherent_to_string", module: "inherent_to_string",
}, },
@ -808,7 +808,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "int_plus_one", name: "int_plus_one",
group: "complexity", group: "complexity",
desc: "instead of using x >= y + 1, use x > y", desc: "instead of using `x >= y + 1`, use `x > y`",
deprecation: None, deprecation: None,
module: "int_plus_one", module: "int_plus_one",
}, },
@ -955,21 +955,21 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "let_underscore_must_use", name: "let_underscore_must_use",
group: "restriction", group: "restriction",
desc: "non-binding let on a #[must_use] expression", desc: "non-binding let on a `#[must_use]` expression",
deprecation: None, deprecation: None,
module: "let_underscore", module: "let_underscore",
}, },
Lint { Lint {
name: "let_unit_value", name: "let_unit_value",
group: "style", group: "style",
desc: "creating a let binding to a value of unit type, which usually can\'t be used afterwards", desc: "creating a `let` binding to a value of unit type, which usually can\'t be used afterwards",
deprecation: None, deprecation: None,
module: "types", module: "types",
}, },
Lint { Lint {
name: "linkedlist", name: "linkedlist",
group: "pedantic", group: "pedantic",
desc: "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a VecDeque", desc: "usage of LinkedList, usually a vector is faster, or a more specialized data structure like a `VecDeque`",
deprecation: None, deprecation: None,
module: "types", module: "types",
}, },
@ -1046,28 +1046,28 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "match_as_ref", name: "match_as_ref",
group: "complexity", group: "complexity",
desc: "a match on an Option value instead of using `as_ref()` or `as_mut`", desc: "a `match` on an Option value instead of using `as_ref()` or `as_mut`",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
Lint { Lint {
name: "match_bool", name: "match_bool",
group: "style", group: "style",
desc: "a match on a boolean expression instead of an `if..else` block", desc: "a `match` on a boolean expression instead of an `if..else` block",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
Lint { Lint {
name: "match_overlapping_arm", name: "match_overlapping_arm",
group: "style", group: "style",
desc: "a match with overlapping arms", desc: "a `match` with overlapping arms",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
Lint { Lint {
name: "match_ref_pats", name: "match_ref_pats",
group: "style", group: "style",
desc: "a match or `if let` with all arms prefixed with `&` instead of deref-ing the match expression", desc: "a `match` or `if let` with all arms prefixed with `&` instead of deref-ing the match expression",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
@ -1081,7 +1081,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "match_wild_err_arm", name: "match_wild_err_arm",
group: "style", group: "style",
desc: "a match with `Err(_)` arm and take drastic actions", desc: "a `match` with `Err(_)` arm and take drastic actions",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
@ -1095,7 +1095,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "mem_discriminant_non_enum", name: "mem_discriminant_non_enum",
group: "correctness", group: "correctness",
desc: "calling mem::descriminant on non-enum type", desc: "calling `mem::descriminant` on non-enum type",
deprecation: None, deprecation: None,
module: "mem_discriminant", module: "mem_discriminant",
}, },
@ -1165,7 +1165,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "missing_inline_in_public_items", name: "missing_inline_in_public_items",
group: "restriction", group: "restriction",
desc: "detects missing #[inline] attribute for public callables (functions, trait methods, methods...)", desc: "detects missing `#[inline]` attribute for public callables (functions, trait methods, methods...)",
deprecation: None, deprecation: None,
module: "missing_inline", module: "missing_inline",
}, },
@ -1270,7 +1270,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "mutable_key_type", name: "mutable_key_type",
group: "correctness", group: "correctness",
desc: "Check for mutable Map/Set key type", desc: "Check for mutable `Map`/`Set` key type",
deprecation: None, deprecation: None,
module: "mut_key", module: "mut_key",
}, },
@ -1382,7 +1382,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "neg_multiply", name: "neg_multiply",
group: "style", group: "style",
desc: "multiplying integers with -1", desc: "multiplying integers with `-1`",
deprecation: None, deprecation: None,
module: "neg_multiply", module: "neg_multiply",
}, },
@ -1480,7 +1480,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "option_map_unit_fn", name: "option_map_unit_fn",
group: "complexity", group: "complexity",
desc: "using `option.map(f)`, where f is a function or closure that returns ()", desc: "using `option.map(f)`, where `f` is a function or closure that returns `()`",
deprecation: None, deprecation: None,
module: "map_unit_fn", module: "map_unit_fn",
}, },
@ -1550,7 +1550,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "panicking_unwrap", name: "panicking_unwrap",
group: "correctness", group: "correctness",
desc: "checks for calls of unwrap[_err]() that will always fail", desc: "checks for calls of `unwrap[_err]()` that will always fail",
deprecation: None, deprecation: None,
module: "unwrap", module: "unwrap",
}, },
@ -1746,7 +1746,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "result_map_unit_fn", name: "result_map_unit_fn",
group: "complexity", group: "complexity",
desc: "using `result.map(f)`, where f is a function or closure that returns ()", desc: "using `result.map(f)`, where `f` is a function or closure that returns `()`",
deprecation: None, deprecation: None,
module: "map_unit_fn", module: "map_unit_fn",
}, },
@ -1774,7 +1774,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "same_functions_in_if_condition", name: "same_functions_in_if_condition",
group: "pedantic", group: "pedantic",
desc: "consecutive `ifs` with the same function call", desc: "consecutive `if`s with the same function call",
deprecation: None, deprecation: None,
module: "copies", module: "copies",
}, },
@ -1844,14 +1844,14 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "single_match", name: "single_match",
group: "style", group: "style",
desc: "a match statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`", desc: "a `match` statement with a single nontrivial arm (i.e., where the other arm is `_ => {}`) instead of `if let`",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
Lint { Lint {
name: "single_match_else", name: "single_match_else",
group: "pedantic", group: "pedantic",
desc: "a match statement with two arms where the second arm\'s pattern is a placeholder instead of a specific match pattern", desc: "a `match` statement with two arms where the second arm\'s pattern is a placeholder instead of a specific match pattern",
deprecation: None, deprecation: None,
module: "matches", module: "matches",
}, },
@ -2159,7 +2159,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "unnecessary_unwrap", name: "unnecessary_unwrap",
group: "complexity", group: "complexity",
desc: "checks for calls of unwrap[_err]() that cannot fail", desc: "checks for calls of `unwrap[_err]()` that cannot fail",
deprecation: None, deprecation: None,
module: "unwrap", module: "unwrap",
}, },
@ -2390,7 +2390,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "zero_divided_by_zero", name: "zero_divided_by_zero",
group: "complexity", group: "complexity",
desc: "usage of `0.0 / 0.0` to obtain NaN instead of std::f32::NaN or std::f64::NaN", desc: "usage of `0.0 / 0.0` to obtain NaN instead of `std::f32::NAN` or `std::f64::NAN`",
deprecation: None, deprecation: None,
module: "zero_div_zero", module: "zero_div_zero",
}, },
@ -2404,7 +2404,7 @@ pub const ALL_LINTS: [Lint; 345] = [
Lint { Lint {
name: "zero_ptr", name: "zero_ptr",
group: "style", group: "style",
desc: "using 0 as *{const, mut} T", desc: "using `0 as *{const, mut} T`",
deprecation: None, deprecation: None,
module: "misc", module: "misc",
}, },

View File

@ -5,7 +5,7 @@ LL | u <= 0;
| ^^^^^^ | ^^^^^^
| |
= note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings` = note: `-D clippy::absurd-extreme-comparisons` implied by `-D warnings`
= help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead = help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 0` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:15:5 --> $DIR/absurd-extreme-comparisons.rs:15:5
@ -13,7 +13,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u <= Z; LL | u <= Z;
| ^^^^^^ | ^^^^^^
| |
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead = help: because `Z` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == Z` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:16:5 --> $DIR/absurd-extreme-comparisons.rs:16:5
@ -21,7 +21,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u < Z; LL | u < Z;
| ^^^^^ | ^^^^^
| |
= help: because Z is the minimum value for this type, this comparison is always false = help: because `Z` is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:17:5 --> $DIR/absurd-extreme-comparisons.rs:17:5
@ -29,7 +29,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | Z >= u; LL | Z >= u;
| ^^^^^^ | ^^^^^^
| |
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead = help: because `Z` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `Z == u` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:18:5 --> $DIR/absurd-extreme-comparisons.rs:18:5
@ -37,7 +37,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | Z > u; LL | Z > u;
| ^^^^^ | ^^^^^
| |
= help: because Z is the minimum value for this type, this comparison is always false = help: because `Z` is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:19:5 --> $DIR/absurd-extreme-comparisons.rs:19:5
@ -45,7 +45,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u > std::u32::MAX; LL | u > std::u32::MAX;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false = help: because `std::u32::MAX` is the maximum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:20:5 --> $DIR/absurd-extreme-comparisons.rs:20:5
@ -53,7 +53,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u >= std::u32::MAX; LL | u >= std::u32::MAX;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead = help: because `std::u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == std::u32::MAX` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:21:5 --> $DIR/absurd-extreme-comparisons.rs:21:5
@ -61,7 +61,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | std::u32::MAX < u; LL | std::u32::MAX < u;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false = help: because `std::u32::MAX` is the maximum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:22:5 --> $DIR/absurd-extreme-comparisons.rs:22:5
@ -69,7 +69,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | std::u32::MAX <= u; LL | std::u32::MAX <= u;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead = help: because `std::u32::MAX` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `std::u32::MAX == u` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:23:5 --> $DIR/absurd-extreme-comparisons.rs:23:5
@ -77,7 +77,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | 1-1 > u; LL | 1-1 > u;
| ^^^^^^^ | ^^^^^^^
| |
= help: because 1-1 is the minimum value for this type, this comparison is always false = help: because `1-1` is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:24:5 --> $DIR/absurd-extreme-comparisons.rs:24:5
@ -85,7 +85,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u >= !0; LL | u >= !0;
| ^^^^^^^ | ^^^^^^^
| |
= help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead = help: because `!0` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `u == !0` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:25:5 --> $DIR/absurd-extreme-comparisons.rs:25:5
@ -93,7 +93,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | u <= 12 - 2*6; LL | u <= 12 - 2*6;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead = help: because `12 - 2*6` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `u == 12 - 2*6` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:27:5 --> $DIR/absurd-extreme-comparisons.rs:27:5
@ -101,7 +101,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | i < -127 - 1; LL | i < -127 - 1;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= help: because -127 - 1 is the minimum value for this type, this comparison is always false = help: because `-127 - 1` is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:28:5 --> $DIR/absurd-extreme-comparisons.rs:28:5
@ -109,7 +109,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | std::i8::MAX >= i; LL | std::i8::MAX >= i;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= help: because std::i8::MAX is the maximum value for this type, this comparison is always true = help: because `std::i8::MAX` is the maximum value for this type, this comparison is always true
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:29:5 --> $DIR/absurd-extreme-comparisons.rs:29:5
@ -117,7 +117,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | 3-7 < std::i32::MIN; LL | 3-7 < std::i32::MIN;
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= help: because std::i32::MIN is the minimum value for this type, this comparison is always false = help: because `std::i32::MIN` is the minimum value for this type, this comparison is always false
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:31:5 --> $DIR/absurd-extreme-comparisons.rs:31:5
@ -125,7 +125,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | b >= true; LL | b >= true;
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead = help: because `true` is the maximum value for this type, the case where the two sides are not equal never occurs, consider using `b == true` instead
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> $DIR/absurd-extreme-comparisons.rs:32:5 --> $DIR/absurd-extreme-comparisons.rs:32:5
@ -133,7 +133,7 @@ error: this comparison involving the minimum or maximum element for this type co
LL | false > b; LL | false > b;
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: because false is the minimum value for this type, this comparison is always false = help: because `false` is the minimum value for this type, this comparison is always false
error: <-comparison of unit values detected. This will always be false error: <-comparison of unit values detected. This will always be false
--> $DIR/absurd-extreme-comparisons.rs:35:5 --> $DIR/absurd-extreme-comparisons.rs:35:5

View File

@ -5,7 +5,7 @@ LL | a += a + 1;
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
= note: `-D clippy::misrefactored-assign-op` implied by `-D warnings` = 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;
| ^^^^^^ | ^^^^^^
@ -20,7 +20,7 @@ error: variable appears on both sides of an assignment operation
LL | a += 1 + a; 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 += 1;
| ^^^^^^ | ^^^^^^
@ -35,7 +35,7 @@ error: variable appears on both sides of an assignment operation
LL | a -= 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 -= 1;
| ^^^^^^ | ^^^^^^
@ -50,7 +50,7 @@ error: variable appears on both sides of an assignment operation
LL | a *= a * 99; 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 *= 99;
| ^^^^^^^ | ^^^^^^^
@ -65,7 +65,7 @@ error: variable appears on both sides of an assignment operation
LL | a *= 42 * a; 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 *= 42;
| ^^^^^^^ | ^^^^^^^
@ -80,7 +80,7 @@ error: variable appears on both sides of an assignment operation
LL | a /= a / 2; 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 /= 2;
| ^^^^^^ | ^^^^^^
@ -95,7 +95,7 @@ error: variable appears on both sides of an assignment operation
LL | a %= a % 5; 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 %= 5;
| ^^^^^^ | ^^^^^^
@ -110,7 +110,7 @@ error: variable appears on both sides of an assignment operation
LL | a &= 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 &= 1;
| ^^^^^^ | ^^^^^^
@ -125,7 +125,7 @@ error: variable appears on both sides of an assignment operation
LL | a *= a * a; 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; LL | a *= a;
| ^^^^^^ | ^^^^^^

View File

@ -1,4 +1,4 @@
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> $DIR/block_in_if_condition.rs:26:8 --> $DIR/block_in_if_condition.rs:26:8
| |
LL | if { LL | if {
@ -30,7 +30,7 @@ LL | if { true } {
6 6
} ... } ...
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> $DIR/block_in_if_condition.rs:58:17 --> $DIR/block_in_if_condition.rs:58:17
| |
LL | |x| { LL | |x| {
@ -40,7 +40,7 @@ LL | | x == target
LL | | }, LL | | },
| |_____________^ | |_____________^
error: in an 'if' condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a 'let' error: in an `if` condition, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
--> $DIR/block_in_if_condition.rs:67:13 --> $DIR/block_in_if_condition.rs:67:13
| |
LL | |x| { LL | |x| {

View File

@ -36,7 +36,7 @@ error: casting u64 to f64 causes a loss of precision (u64 is 64 bits wide, but f
LL | x3 as f64; LL | x3 as f64;
| ^^^^^^^^^ | ^^^^^^^^^
error: casting f32 to i32 may truncate the value error: casting `f32` to `i32` may truncate the value
--> $DIR/cast.rs:21:5 --> $DIR/cast.rs:21:5
| |
LL | 1f32 as i32; LL | 1f32 as i32;
@ -44,13 +44,13 @@ LL | 1f32 as i32;
| |
= note: `-D clippy::cast-possible-truncation` implied by `-D warnings` = note: `-D clippy::cast-possible-truncation` implied by `-D warnings`
error: casting f32 to u32 may truncate the value error: casting `f32` to `u32` may truncate the value
--> $DIR/cast.rs:22:5 --> $DIR/cast.rs:22:5
| |
LL | 1f32 as u32; LL | 1f32 as u32;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: casting f32 to u32 may lose the sign of the value error: casting `f32` to `u32` may lose the sign of the value
--> $DIR/cast.rs:22:5 --> $DIR/cast.rs:22:5
| |
LL | 1f32 as u32; LL | 1f32 as u32;
@ -58,43 +58,43 @@ LL | 1f32 as u32;
| |
= note: `-D clippy::cast-sign-loss` implied by `-D warnings` = note: `-D clippy::cast-sign-loss` implied by `-D warnings`
error: casting f64 to f32 may truncate the value error: casting `f64` to `f32` may truncate the value
--> $DIR/cast.rs:23:5 --> $DIR/cast.rs:23:5
| |
LL | 1f64 as f32; LL | 1f64 as f32;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: casting i32 to i8 may truncate the value error: casting `i32` to `i8` may truncate the value
--> $DIR/cast.rs:24:5 --> $DIR/cast.rs:24:5
| |
LL | 1i32 as i8; LL | 1i32 as i8;
| ^^^^^^^^^^ | ^^^^^^^^^^
error: casting i32 to u8 may truncate the value error: casting `i32` to `u8` may truncate the value
--> $DIR/cast.rs:25:5 --> $DIR/cast.rs:25:5
| |
LL | 1i32 as u8; LL | 1i32 as u8;
| ^^^^^^^^^^ | ^^^^^^^^^^
error: casting f64 to isize may truncate the value error: casting `f64` to `isize` may truncate the value
--> $DIR/cast.rs:26:5 --> $DIR/cast.rs:26:5
| |
LL | 1f64 as isize; LL | 1f64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting f64 to usize may truncate the value error: casting `f64` to `usize` may truncate the value
--> $DIR/cast.rs:27:5 --> $DIR/cast.rs:27:5
| |
LL | 1f64 as usize; LL | 1f64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting f64 to usize may lose the sign of the value error: casting `f64` to `usize` may lose the sign of the value
--> $DIR/cast.rs:27:5 --> $DIR/cast.rs:27:5
| |
LL | 1f64 as usize; LL | 1f64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u8 to i8 may wrap around the value error: casting `u8` to `i8` may wrap around the value
--> $DIR/cast.rs:29:5 --> $DIR/cast.rs:29:5
| |
LL | 1u8 as i8; LL | 1u8 as i8;
@ -102,37 +102,37 @@ LL | 1u8 as i8;
| |
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings` = note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
error: casting u16 to i16 may wrap around the value error: casting `u16` to `i16` may wrap around the value
--> $DIR/cast.rs:30:5 --> $DIR/cast.rs:30:5
| |
LL | 1u16 as i16; LL | 1u16 as i16;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: casting u32 to i32 may wrap around the value error: casting `u32` to `i32` may wrap around the value
--> $DIR/cast.rs:31:5 --> $DIR/cast.rs:31:5
| |
LL | 1u32 as i32; LL | 1u32 as i32;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: casting u64 to i64 may wrap around the value error: casting `u64` to `i64` may wrap around the value
--> $DIR/cast.rs:32:5 --> $DIR/cast.rs:32:5
| |
LL | 1u64 as i64; LL | 1u64 as i64;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: casting usize to isize may wrap around the value error: casting `usize` to `isize` may wrap around the value
--> $DIR/cast.rs:33:5 --> $DIR/cast.rs:33:5
| |
LL | 1usize as isize; LL | 1usize as isize;
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: casting i32 to u32 may lose the sign of the value error: casting `i32` to `u32` may lose the sign of the value
--> $DIR/cast.rs:36:5 --> $DIR/cast.rs:36:5
| |
LL | -1i32 as u32; LL | -1i32 as u32;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: casting isize to usize may lose the sign of the value error: casting `isize` to `usize` may lose the sign of the value
--> $DIR/cast.rs:38:5 --> $DIR/cast.rs:38:5
| |
LL | -1isize as usize; LL | -1isize as usize;

View File

@ -1,4 +1,4 @@
error: casting i8 to f32 may become silently lossy if you later change the type error: casting `i8` to `f32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:9:5 --> $DIR/cast_lossless_float.rs:9:5
| |
LL | x0 as f32; LL | x0 as f32;
@ -6,61 +6,61 @@ LL | x0 as f32;
| |
= note: `-D clippy::cast-lossless` implied by `-D warnings` = note: `-D clippy::cast-lossless` implied by `-D warnings`
error: casting i8 to f64 may become silently lossy if you later change the type error: casting `i8` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:10:5 --> $DIR/cast_lossless_float.rs:10:5
| |
LL | x0 as f64; LL | x0 as f64;
| ^^^^^^^^^ help: try: `f64::from(x0)` | ^^^^^^^^^ help: try: `f64::from(x0)`
error: casting u8 to f32 may become silently lossy if you later change the type error: casting `u8` to `f32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:12:5 --> $DIR/cast_lossless_float.rs:12:5
| |
LL | x1 as f32; LL | x1 as f32;
| ^^^^^^^^^ help: try: `f32::from(x1)` | ^^^^^^^^^ help: try: `f32::from(x1)`
error: casting u8 to f64 may become silently lossy if you later change the type error: casting `u8` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:13:5 --> $DIR/cast_lossless_float.rs:13:5
| |
LL | x1 as f64; LL | x1 as f64;
| ^^^^^^^^^ help: try: `f64::from(x1)` | ^^^^^^^^^ help: try: `f64::from(x1)`
error: casting i16 to f32 may become silently lossy if you later change the type error: casting `i16` to `f32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:15:5 --> $DIR/cast_lossless_float.rs:15:5
| |
LL | x2 as f32; LL | x2 as f32;
| ^^^^^^^^^ help: try: `f32::from(x2)` | ^^^^^^^^^ help: try: `f32::from(x2)`
error: casting i16 to f64 may become silently lossy if you later change the type error: casting `i16` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:16:5 --> $DIR/cast_lossless_float.rs:16:5
| |
LL | x2 as f64; LL | x2 as f64;
| ^^^^^^^^^ help: try: `f64::from(x2)` | ^^^^^^^^^ help: try: `f64::from(x2)`
error: casting u16 to f32 may become silently lossy if you later change the type error: casting `u16` to `f32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:18:5 --> $DIR/cast_lossless_float.rs:18:5
| |
LL | x3 as f32; LL | x3 as f32;
| ^^^^^^^^^ help: try: `f32::from(x3)` | ^^^^^^^^^ help: try: `f32::from(x3)`
error: casting u16 to f64 may become silently lossy if you later change the type error: casting `u16` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:19:5 --> $DIR/cast_lossless_float.rs:19:5
| |
LL | x3 as f64; LL | x3 as f64;
| ^^^^^^^^^ help: try: `f64::from(x3)` | ^^^^^^^^^ help: try: `f64::from(x3)`
error: casting i32 to f64 may become silently lossy if you later change the type error: casting `i32` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:21:5 --> $DIR/cast_lossless_float.rs:21:5
| |
LL | x4 as f64; LL | x4 as f64;
| ^^^^^^^^^ help: try: `f64::from(x4)` | ^^^^^^^^^ help: try: `f64::from(x4)`
error: casting u32 to f64 may become silently lossy if you later change the type error: casting `u32` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:23:5 --> $DIR/cast_lossless_float.rs:23:5
| |
LL | x5 as f64; LL | x5 as f64;
| ^^^^^^^^^ help: try: `f64::from(x5)` | ^^^^^^^^^ help: try: `f64::from(x5)`
error: casting f32 to f64 may become silently lossy if you later change the type error: casting `f32` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_float.rs:26:5 --> $DIR/cast_lossless_float.rs:26:5
| |
LL | 1.0f32 as f64; LL | 1.0f32 as f64;

View File

@ -1,4 +1,4 @@
error: casting i8 to i16 may become silently lossy if you later change the type error: casting `i8` to `i16` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:8:5 --> $DIR/cast_lossless_integer.rs:8:5
| |
LL | 1i8 as i16; LL | 1i8 as i16;
@ -6,109 +6,109 @@ LL | 1i8 as i16;
| |
= note: `-D clippy::cast-lossless` implied by `-D warnings` = note: `-D clippy::cast-lossless` implied by `-D warnings`
error: casting i8 to i32 may become silently lossy if you later change the type error: casting `i8` to `i32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:9:5 --> $DIR/cast_lossless_integer.rs:9:5
| |
LL | 1i8 as i32; LL | 1i8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1i8)` | ^^^^^^^^^^ help: try: `i32::from(1i8)`
error: casting i8 to i64 may become silently lossy if you later change the type error: casting `i8` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:10:5 --> $DIR/cast_lossless_integer.rs:10:5
| |
LL | 1i8 as i64; LL | 1i8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1i8)` | ^^^^^^^^^^ help: try: `i64::from(1i8)`
error: casting u8 to i16 may become silently lossy if you later change the type error: casting `u8` to `i16` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:11:5 --> $DIR/cast_lossless_integer.rs:11:5
| |
LL | 1u8 as i16; LL | 1u8 as i16;
| ^^^^^^^^^^ help: try: `i16::from(1u8)` | ^^^^^^^^^^ help: try: `i16::from(1u8)`
error: casting u8 to i32 may become silently lossy if you later change the type error: casting `u8` to `i32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:12:5 --> $DIR/cast_lossless_integer.rs:12:5
| |
LL | 1u8 as i32; LL | 1u8 as i32;
| ^^^^^^^^^^ help: try: `i32::from(1u8)` | ^^^^^^^^^^ help: try: `i32::from(1u8)`
error: casting u8 to i64 may become silently lossy if you later change the type error: casting `u8` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:13:5 --> $DIR/cast_lossless_integer.rs:13:5
| |
LL | 1u8 as i64; LL | 1u8 as i64;
| ^^^^^^^^^^ help: try: `i64::from(1u8)` | ^^^^^^^^^^ help: try: `i64::from(1u8)`
error: casting u8 to u16 may become silently lossy if you later change the type error: casting `u8` to `u16` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:14:5 --> $DIR/cast_lossless_integer.rs:14:5
| |
LL | 1u8 as u16; LL | 1u8 as u16;
| ^^^^^^^^^^ help: try: `u16::from(1u8)` | ^^^^^^^^^^ help: try: `u16::from(1u8)`
error: casting u8 to u32 may become silently lossy if you later change the type error: casting `u8` to `u32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:15:5 --> $DIR/cast_lossless_integer.rs:15:5
| |
LL | 1u8 as u32; LL | 1u8 as u32;
| ^^^^^^^^^^ help: try: `u32::from(1u8)` | ^^^^^^^^^^ help: try: `u32::from(1u8)`
error: casting u8 to u64 may become silently lossy if you later change the type error: casting `u8` to `u64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:16:5 --> $DIR/cast_lossless_integer.rs:16:5
| |
LL | 1u8 as u64; LL | 1u8 as u64;
| ^^^^^^^^^^ help: try: `u64::from(1u8)` | ^^^^^^^^^^ help: try: `u64::from(1u8)`
error: casting i16 to i32 may become silently lossy if you later change the type error: casting `i16` to `i32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:17:5 --> $DIR/cast_lossless_integer.rs:17:5
| |
LL | 1i16 as i32; LL | 1i16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1i16)` | ^^^^^^^^^^^ help: try: `i32::from(1i16)`
error: casting i16 to i64 may become silently lossy if you later change the type error: casting `i16` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:18:5 --> $DIR/cast_lossless_integer.rs:18:5
| |
LL | 1i16 as i64; LL | 1i16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i16)` | ^^^^^^^^^^^ help: try: `i64::from(1i16)`
error: casting u16 to i32 may become silently lossy if you later change the type error: casting `u16` to `i32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:19:5 --> $DIR/cast_lossless_integer.rs:19:5
| |
LL | 1u16 as i32; LL | 1u16 as i32;
| ^^^^^^^^^^^ help: try: `i32::from(1u16)` | ^^^^^^^^^^^ help: try: `i32::from(1u16)`
error: casting u16 to i64 may become silently lossy if you later change the type error: casting `u16` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:20:5 --> $DIR/cast_lossless_integer.rs:20:5
| |
LL | 1u16 as i64; LL | 1u16 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u16)` | ^^^^^^^^^^^ help: try: `i64::from(1u16)`
error: casting u16 to u32 may become silently lossy if you later change the type error: casting `u16` to `u32` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:21:5 --> $DIR/cast_lossless_integer.rs:21:5
| |
LL | 1u16 as u32; LL | 1u16 as u32;
| ^^^^^^^^^^^ help: try: `u32::from(1u16)` | ^^^^^^^^^^^ help: try: `u32::from(1u16)`
error: casting u16 to u64 may become silently lossy if you later change the type error: casting `u16` to `u64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:22:5 --> $DIR/cast_lossless_integer.rs:22:5
| |
LL | 1u16 as u64; LL | 1u16 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u16)` | ^^^^^^^^^^^ help: try: `u64::from(1u16)`
error: casting i32 to i64 may become silently lossy if you later change the type error: casting `i32` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:23:5 --> $DIR/cast_lossless_integer.rs:23:5
| |
LL | 1i32 as i64; LL | 1i32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1i32)` | ^^^^^^^^^^^ help: try: `i64::from(1i32)`
error: casting u32 to i64 may become silently lossy if you later change the type error: casting `u32` to `i64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:24:5 --> $DIR/cast_lossless_integer.rs:24:5
| |
LL | 1u32 as i64; LL | 1u32 as i64;
| ^^^^^^^^^^^ help: try: `i64::from(1u32)` | ^^^^^^^^^^^ help: try: `i64::from(1u32)`
error: casting u32 to u64 may become silently lossy if you later change the type error: casting `u32` to `u64` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:25:5 --> $DIR/cast_lossless_integer.rs:25:5
| |
LL | 1u32 as u64; LL | 1u32 as u64;
| ^^^^^^^^^^^ help: try: `u64::from(1u32)` | ^^^^^^^^^^^ help: try: `u64::from(1u32)`
error: casting u8 to u16 may become silently lossy if you later change the type error: casting `u8` to `u16` may become silently lossy if you later change the type
--> $DIR/cast_lossless_integer.rs:28:5 --> $DIR/cast_lossless_integer.rs:28:5
| |
LL | (1u8 + 1u8) as u16; LL | (1u8 + 1u8) as u16;

View File

@ -1,4 +1,4 @@
error: casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:18:9 --> $DIR/cast_ref_to_mut.rs:18:9
| |
LL | (*(a as *const _ as *mut String)).push_str(" world"); LL | (*(a as *const _ as *mut String)).push_str(" world");
@ -6,13 +6,13 @@ LL | (*(a as *const _ as *mut String)).push_str(" world");
| |
= note: `-D clippy::cast-ref-to-mut` implied by `-D warnings` = note: `-D clippy::cast-ref-to-mut` implied by `-D warnings`
error: casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:19:9 --> $DIR/cast_ref_to_mut.rs:19:9
| |
LL | *(a as *const _ as *mut _) = String::from("Replaced"); LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:20:9 --> $DIR/cast_ref_to_mut.rs:20:9
| |
LL | *(a as *const _ as *mut String) += " world"; LL | *(a as *const _ as *mut String) += " world";

View File

@ -1,4 +1,4 @@
error: casting isize to i8 may truncate the value error: casting `isize` to `i8` may truncate the value
--> $DIR/cast_size.rs:12:5 --> $DIR/cast_size.rs:12:5
| |
LL | 1isize as i8; LL | 1isize as i8;
@ -32,31 +32,31 @@ error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits w
LL | x1 as f32; LL | x1 as f32;
| ^^^^^^^^^ | ^^^^^^^^^
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:19:5 --> $DIR/cast_size.rs:19:5
| |
LL | 1isize as i32; LL | 1isize as i32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:20:5 --> $DIR/cast_size.rs:20:5
| |
LL | 1isize as u32; LL | 1isize as u32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:21:5 --> $DIR/cast_size.rs:21:5
| |
LL | 1usize as u32; LL | 1usize as u32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:22:5 --> $DIR/cast_size.rs:22:5
| |
LL | 1usize as i32; LL | 1usize as i32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:22:5 --> $DIR/cast_size.rs:22:5
| |
LL | 1usize as i32; LL | 1usize as i32;
@ -64,37 +64,37 @@ LL | 1usize as i32;
| |
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings` = note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:24:5 --> $DIR/cast_size.rs:24:5
| |
LL | 1i64 as isize; LL | 1i64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:25:5 --> $DIR/cast_size.rs:25:5
| |
LL | 1i64 as usize; LL | 1i64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:26:5 --> $DIR/cast_size.rs:26:5
| |
LL | 1u64 as isize; LL | 1u64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
--> $DIR/cast_size.rs:26:5 --> $DIR/cast_size.rs:26:5
| |
LL | 1u64 as isize; LL | 1u64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:27:5 --> $DIR/cast_size.rs:27:5
| |
LL | 1u64 as usize; LL | 1u64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size.rs:28:5 --> $DIR/cast_size.rs:28:5
| |
LL | 1u32 as isize; LL | 1u32 as isize;

View File

@ -1,4 +1,4 @@
error: casting isize to i8 may truncate the value error: casting `isize` to `i8` may truncate the value
--> $DIR/cast_size_32bit.rs:12:5 --> $DIR/cast_size_32bit.rs:12:5
| |
LL | 1isize as i8; LL | 1isize as i8;
@ -14,7 +14,7 @@ LL | x0 as f64;
| |
= note: `-D clippy::cast-precision-loss` implied by `-D warnings` = note: `-D clippy::cast-precision-loss` implied by `-D warnings`
error: casting isize to f64 may become silently lossy if you later change the type error: casting `isize` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_size_32bit.rs:15:5 --> $DIR/cast_size_32bit.rs:15:5
| |
LL | x0 as f64; LL | x0 as f64;
@ -28,7 +28,7 @@ error: casting usize to f64 causes a loss of precision on targets with 64-bit wi
LL | x1 as f64; LL | x1 as f64;
| ^^^^^^^^^ | ^^^^^^^^^
error: casting usize to f64 may become silently lossy if you later change the type error: casting `usize` to `f64` may become silently lossy if you later change the type
--> $DIR/cast_size_32bit.rs:16:5 --> $DIR/cast_size_32bit.rs:16:5
| |
LL | x1 as f64; LL | x1 as f64;
@ -46,31 +46,31 @@ error: casting usize to f32 causes a loss of precision (usize is 32 or 64 bits w
LL | x1 as f32; LL | x1 as f32;
| ^^^^^^^^^ | ^^^^^^^^^
error: casting isize to i32 may truncate the value on targets with 64-bit wide pointers error: casting `isize` to `i32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size_32bit.rs:19:5 --> $DIR/cast_size_32bit.rs:19:5
| |
LL | 1isize as i32; LL | 1isize as i32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting isize to u32 may truncate the value on targets with 64-bit wide pointers error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size_32bit.rs:20:5 --> $DIR/cast_size_32bit.rs:20:5
| |
LL | 1isize as u32; LL | 1isize as u32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to u32 may truncate the value on targets with 64-bit wide pointers error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size_32bit.rs:21:5 --> $DIR/cast_size_32bit.rs:21:5
| |
LL | 1usize as u32; LL | 1usize as u32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to i32 may truncate the value on targets with 64-bit wide pointers error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
--> $DIR/cast_size_32bit.rs:22:5 --> $DIR/cast_size_32bit.rs:22:5
| |
LL | 1usize as i32; LL | 1usize as i32;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting usize to i32 may wrap around the value on targets with 32-bit wide pointers error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:22:5 --> $DIR/cast_size_32bit.rs:22:5
| |
LL | 1usize as i32; LL | 1usize as i32;
@ -78,37 +78,37 @@ LL | 1usize as i32;
| |
= note: `-D clippy::cast-possible-wrap` implied by `-D warnings` = note: `-D clippy::cast-possible-wrap` implied by `-D warnings`
error: casting i64 to isize may truncate the value on targets with 32-bit wide pointers error: casting `i64` to `isize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:24:5 --> $DIR/cast_size_32bit.rs:24:5
| |
LL | 1i64 as isize; LL | 1i64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting i64 to usize may truncate the value on targets with 32-bit wide pointers error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:25:5 --> $DIR/cast_size_32bit.rs:25:5
| |
LL | 1i64 as usize; LL | 1i64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to isize may truncate the value on targets with 32-bit wide pointers error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:26:5 --> $DIR/cast_size_32bit.rs:26:5
| |
LL | 1u64 as isize; LL | 1u64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to isize may wrap around the value on targets with 64-bit wide pointers error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
--> $DIR/cast_size_32bit.rs:26:5 --> $DIR/cast_size_32bit.rs:26:5
| |
LL | 1u64 as isize; LL | 1u64 as isize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u64 to usize may truncate the value on targets with 32-bit wide pointers error: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:27:5 --> $DIR/cast_size_32bit.rs:27:5
| |
LL | 1u64 as usize; LL | 1u64 as usize;
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: casting u32 to isize may wrap around the value on targets with 32-bit wide pointers error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
--> $DIR/cast_size_32bit.rs:28:5 --> $DIR/cast_size_32bit.rs:28:5
| |
LL | 1u32 as isize; LL | 1u32 as isize;
@ -120,7 +120,7 @@ error: casting i32 to f32 causes a loss of precision (i32 is 32 bits wide, but f
LL | 999_999_999 as f32; LL | 999_999_999 as f32;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: casting integer literal to f64 is unnecessary error: casting integer literal to `f64` is unnecessary
--> $DIR/cast_size_32bit.rs:34:5 --> $DIR/cast_size_32bit.rs:34:5
| |
LL | 3_999_999_999usize as f64; LL | 3_999_999_999usize as f64;

View File

@ -1,4 +1,4 @@
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes
--> $DIR/cfg_attr_rustfmt.rs:18:5 --> $DIR/cfg_attr_rustfmt.rs:18:5
| |
LL | #[cfg_attr(rustfmt, rustfmt::skip)] LL | #[cfg_attr(rustfmt, rustfmt::skip)]
@ -6,7 +6,7 @@ LL | #[cfg_attr(rustfmt, rustfmt::skip)]
| |
= note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings` = note: `-D clippy::deprecated-cfg-attr` implied by `-D warnings`
error: `cfg_attr` is deprecated for rustfmt and got replaced by tool_attributes error: `cfg_attr` is deprecated for rustfmt and got replaced by tool attributes
--> $DIR/cfg_attr_rustfmt.rs:22:1 --> $DIR/cfg_attr_rustfmt.rs:22:1
| |
LL | #[cfg_attr(rustfmt, rustfmt_skip)] LL | #[cfg_attr(rustfmt, rustfmt_skip)]

View File

@ -1,4 +1,4 @@
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:8:5 --> $DIR/cmp_nan.rs:8:5
| |
LL | x == std::f32::NAN; LL | x == std::f32::NAN;
@ -6,139 +6,139 @@ LL | x == std::f32::NAN;
| |
= note: `-D clippy::cmp-nan` implied by `-D warnings` = note: `-D clippy::cmp-nan` implied by `-D warnings`
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:9:5 --> $DIR/cmp_nan.rs:9:5
| |
LL | x != std::f32::NAN; LL | x != std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:10:5 --> $DIR/cmp_nan.rs:10:5
| |
LL | x < std::f32::NAN; LL | x < std::f32::NAN;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:11:5 --> $DIR/cmp_nan.rs:11:5
| |
LL | x > std::f32::NAN; LL | x > std::f32::NAN;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:12:5 --> $DIR/cmp_nan.rs:12:5
| |
LL | x <= std::f32::NAN; LL | x <= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:13:5 --> $DIR/cmp_nan.rs:13:5
| |
LL | x >= std::f32::NAN; LL | x >= std::f32::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:14:5 --> $DIR/cmp_nan.rs:14:5
| |
LL | x == NAN_F32; LL | x == NAN_F32;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:15:5 --> $DIR/cmp_nan.rs:15:5
| |
LL | x != NAN_F32; LL | x != NAN_F32;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:16:5 --> $DIR/cmp_nan.rs:16:5
| |
LL | x < NAN_F32; LL | x < NAN_F32;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:17:5 --> $DIR/cmp_nan.rs:17:5
| |
LL | x > NAN_F32; LL | x > NAN_F32;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:18:5 --> $DIR/cmp_nan.rs:18:5
| |
LL | x <= NAN_F32; LL | x <= NAN_F32;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:19:5 --> $DIR/cmp_nan.rs:19:5
| |
LL | x >= NAN_F32; LL | x >= NAN_F32;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:22:5 --> $DIR/cmp_nan.rs:22:5
| |
LL | y == std::f64::NAN; LL | y == std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:23:5 --> $DIR/cmp_nan.rs:23:5
| |
LL | y != std::f64::NAN; LL | y != std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:24:5 --> $DIR/cmp_nan.rs:24:5
| |
LL | y < std::f64::NAN; LL | y < std::f64::NAN;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:25:5 --> $DIR/cmp_nan.rs:25:5
| |
LL | y > std::f64::NAN; LL | y > std::f64::NAN;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:26:5 --> $DIR/cmp_nan.rs:26:5
| |
LL | y <= std::f64::NAN; LL | y <= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:27:5 --> $DIR/cmp_nan.rs:27:5
| |
LL | y >= std::f64::NAN; LL | y >= std::f64::NAN;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:28:5 --> $DIR/cmp_nan.rs:28:5
| |
LL | y == NAN_F64; LL | y == NAN_F64;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:29:5 --> $DIR/cmp_nan.rs:29:5
| |
LL | y != NAN_F64; LL | y != NAN_F64;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:30:5 --> $DIR/cmp_nan.rs:30:5
| |
LL | y < NAN_F64; LL | y < NAN_F64;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:31:5 --> $DIR/cmp_nan.rs:31:5
| |
LL | y > NAN_F64; LL | y > NAN_F64;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:32:5 --> $DIR/cmp_nan.rs:32:5
| |
LL | y <= NAN_F64; LL | y <= NAN_F64;
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead error: doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead
--> $DIR/cmp_nan.rs:33:5 --> $DIR/cmp_nan.rs:33:5
| |
LL | y >= NAN_F64; LL | y >= NAN_F64;

View File

@ -1,4 +1,4 @@
error: Comparing with null is better expressed by the .is_null() method error: Comparing with null is better expressed by the `.is_null()` method
--> $DIR/cmp_null.rs:9:8 --> $DIR/cmp_null.rs:9:8
| |
LL | if p == ptr::null() { LL | if p == ptr::null() {
@ -6,7 +6,7 @@ LL | if p == ptr::null() {
| |
= note: `-D clippy::cmp-null` implied by `-D warnings` = note: `-D clippy::cmp-null` implied by `-D warnings`
error: Comparing with null is better expressed by the .is_null() method error: Comparing with null is better expressed by the `.is_null()` method
--> $DIR/cmp_null.rs:14:8 --> $DIR/cmp_null.rs:14:8
| |
LL | if m == ptr::null_mut() { LL | if m == ptr::null_mut() {

View File

@ -1,4 +1,4 @@
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:9:5 --> $DIR/collapsible_if.rs:9:5
| |
LL | / if x == "hello" { LL | / if x == "hello" {
@ -16,7 +16,7 @@ LL | println!("Hello world!");
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:15:5 --> $DIR/collapsible_if.rs:15:5
| |
LL | / if x == "hello" || x == "world" { LL | / if x == "hello" || x == "world" {
@ -33,7 +33,7 @@ LL | println!("Hello world!");
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:21:5 --> $DIR/collapsible_if.rs:21:5
| |
LL | / if x == "hello" && x == "world" { LL | / if x == "hello" && x == "world" {
@ -50,7 +50,7 @@ LL | println!("Hello world!");
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:27:5 --> $DIR/collapsible_if.rs:27:5
| |
LL | / if x == "hello" || x == "world" { LL | / if x == "hello" || x == "world" {
@ -67,7 +67,7 @@ LL | println!("Hello world!");
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:33:5 --> $DIR/collapsible_if.rs:33:5
| |
LL | / if x == "hello" && x == "world" { LL | / if x == "hello" && x == "world" {
@ -84,7 +84,7 @@ LL | println!("Hello world!");
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:39:5 --> $DIR/collapsible_if.rs:39:5
| |
LL | / if 42 == 1337 { LL | / if 42 == 1337 {
@ -101,7 +101,7 @@ LL | println!("world!")
LL | } LL | }
| |
error: this if statement can be collapsed error: this `if` statement can be collapsed
--> $DIR/collapsible_if.rs:95:5 --> $DIR/collapsible_if.rs:95:5
| |
LL | / if x == "hello" { LL | / if x == "hello" {

View File

@ -1,4 +1,4 @@
error: Calling std::string::String::default() is more clear than this expression error: Calling `std::string::String::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:8:22 --> $DIR/default_trait_access.rs:8:22
| |
LL | let s1: String = Default::default(); LL | let s1: String = Default::default();
@ -6,43 +6,43 @@ LL | let s1: String = Default::default();
| |
= note: `-D clippy::default-trait-access` implied by `-D warnings` = note: `-D clippy::default-trait-access` implied by `-D warnings`
error: Calling std::string::String::default() is more clear than this expression error: Calling `std::string::String::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:12:22 --> $DIR/default_trait_access.rs:12:22
| |
LL | let s3: String = D2::default(); LL | let s3: String = D2::default();
| ^^^^^^^^^^^^^ help: try: `std::string::String::default()` | ^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression error: Calling `std::string::String::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:14:22 --> $DIR/default_trait_access.rs:14:22
| |
LL | let s4: String = std::default::Default::default(); LL | let s4: String = std::default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling std::string::String::default() is more clear than this expression error: Calling `std::string::String::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:18:22 --> $DIR/default_trait_access.rs:18:22
| |
LL | let s6: String = default::Default::default(); LL | let s6: String = default::Default::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::string::String::default()`
error: Calling GenericDerivedDefault<std::string::String>::default() is more clear than this expression error: Calling `GenericDerivedDefault<std::string::String>::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:28:46 --> $DIR/default_trait_access.rs:28:46
| |
LL | let s11: GenericDerivedDefault<String> = Default::default(); LL | let s11: GenericDerivedDefault<String> = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault<std::string::String>::default()` | ^^^^^^^^^^^^^^^^^^ help: try: `GenericDerivedDefault<std::string::String>::default()`
error: Calling TupleDerivedDefault::default() is more clear than this expression error: Calling `TupleDerivedDefault::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:34:36 --> $DIR/default_trait_access.rs:34:36
| |
LL | let s14: TupleDerivedDefault = Default::default(); LL | let s14: TupleDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()` | ^^^^^^^^^^^^^^^^^^ help: try: `TupleDerivedDefault::default()`
error: Calling ArrayDerivedDefault::default() is more clear than this expression error: Calling `ArrayDerivedDefault::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:36:36 --> $DIR/default_trait_access.rs:36:36
| |
LL | let s15: ArrayDerivedDefault = Default::default(); LL | let s15: ArrayDerivedDefault = Default::default();
| ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()` | ^^^^^^^^^^^^^^^^^^ help: try: `ArrayDerivedDefault::default()`
error: Calling TupleStructDerivedDefault::default() is more clear than this expression error: Calling `TupleStructDerivedDefault::default()` is more clear than this expression
--> $DIR/default_trait_access.rs:40:42 --> $DIR/default_trait_access.rs:40:42
| |
LL | let s17: TupleStructDerivedDefault = Default::default(); LL | let s17: TupleStructDerivedDefault = Default::default();

View File

@ -5,7 +5,7 @@ LL | type Baz = LinkedList<u8>;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= note: `-D clippy::linkedlist` implied by `-D warnings` = note: `-D clippy::linkedlist` implied by `-D warnings`
= help: a VecDeque might work = help: a `VecDeque` might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure? error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:10:15 --> $DIR/dlist.rs:10:15
@ -13,7 +13,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
LL | fn foo(_: LinkedList<u8>); LL | fn foo(_: LinkedList<u8>);
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: a VecDeque might work = help: a `VecDeque` might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure? error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:11:23 --> $DIR/dlist.rs:11:23
@ -21,7 +21,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
LL | const BAR: Option<LinkedList<u8>>; LL | const BAR: Option<LinkedList<u8>>;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: a VecDeque might work = help: a `VecDeque` might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure? error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:22:15 --> $DIR/dlist.rs:22:15
@ -29,7 +29,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
LL | fn foo(_: LinkedList<u8>) {} LL | fn foo(_: LinkedList<u8>) {}
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: a VecDeque might work = help: a `VecDeque` might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure? error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:25:39 --> $DIR/dlist.rs:25:39
@ -37,7 +37,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) { LL | pub fn test(my_favourite_linked_list: LinkedList<u8>) {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: a VecDeque might work = help: a `VecDeque` might work
error: I see you're using a LinkedList! Perhaps you meant some other data structure? error: I see you're using a LinkedList! Perhaps you meant some other data structure?
--> $DIR/dlist.rs:29:29 --> $DIR/dlist.rs:29:29
@ -45,7 +45,7 @@ error: I see you're using a LinkedList! Perhaps you meant some other data struct
LL | pub fn test_ret() -> Option<LinkedList<u8>> { LL | pub fn test_ret() -> Option<LinkedList<u8>> {
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: a VecDeque might work = help: a `VecDeque` might work
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -1,4 +1,4 @@
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 --> $DIR/drop_forget_copy.rs:33:5
| |
LL | drop(s1); LL | drop(s1);
@ -11,7 +11,7 @@ note: argument has type SomeStruct
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 --> $DIR/drop_forget_copy.rs:34:5
| |
LL | drop(s2); LL | drop(s2);
@ -23,7 +23,7 @@ note: argument has type SomeStruct
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 --> $DIR/drop_forget_copy.rs:36:5
| |
LL | drop(s4); LL | drop(s4);
@ -35,7 +35,7 @@ note: argument has type SomeStruct
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 --> $DIR/drop_forget_copy.rs:39:5
| |
LL | forget(s1); LL | forget(s1);
@ -48,7 +48,7 @@ note: argument has type SomeStruct
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 --> $DIR/drop_forget_copy.rs:40:5
| |
LL | forget(s2); LL | forget(s2);
@ -60,7 +60,7 @@ note: argument has type SomeStruct
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 --> $DIR/drop_forget_copy.rs:42:5
| |
LL | forget(s4); LL | forget(s4);

View File

@ -5,7 +5,7 @@ LL | drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::drop-ref` implied by `-D warnings` = note: `-D clippy::drop-ref` implied by `-D warnings`
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:9:10 --> $DIR/drop_forget_ref.rs:9:10
| |
LL | drop(&SomeStruct); LL | drop(&SomeStruct);
@ -18,7 +18,7 @@ LL | forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::forget-ref` implied by `-D warnings` = note: `-D clippy::forget-ref` implied by `-D warnings`
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:10:12 --> $DIR/drop_forget_ref.rs:10:12
| |
LL | forget(&SomeStruct); LL | forget(&SomeStruct);
@ -30,7 +30,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(&owned1); LL | drop(&owned1);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:13:10 --> $DIR/drop_forget_ref.rs:13:10
| |
LL | drop(&owned1); LL | drop(&owned1);
@ -42,7 +42,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(&&owned1); LL | drop(&&owned1);
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: argument has type &&SomeStruct note: argument has type `&&SomeStruct`
--> $DIR/drop_forget_ref.rs:14:10 --> $DIR/drop_forget_ref.rs:14:10
| |
LL | drop(&&owned1); LL | drop(&&owned1);
@ -54,7 +54,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(&mut owned1); LL | drop(&mut owned1);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
note: argument has type &mut SomeStruct note: argument has type `&mut SomeStruct`
--> $DIR/drop_forget_ref.rs:15:10 --> $DIR/drop_forget_ref.rs:15:10
| |
LL | drop(&mut owned1); LL | drop(&mut owned1);
@ -66,7 +66,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(&owned2); LL | forget(&owned2);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:18:12 --> $DIR/drop_forget_ref.rs:18:12
| |
LL | forget(&owned2); LL | forget(&owned2);
@ -78,7 +78,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(&&owned2); LL | forget(&&owned2);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: argument has type &&SomeStruct note: argument has type `&&SomeStruct`
--> $DIR/drop_forget_ref.rs:19:12 --> $DIR/drop_forget_ref.rs:19:12
| |
LL | forget(&&owned2); LL | forget(&&owned2);
@ -90,7 +90,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(&mut owned2); LL | forget(&mut owned2);
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
note: argument has type &mut SomeStruct note: argument has type `&mut SomeStruct`
--> $DIR/drop_forget_ref.rs:20:12 --> $DIR/drop_forget_ref.rs:20:12
| |
LL | forget(&mut owned2); LL | forget(&mut owned2);
@ -102,7 +102,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(reference1); LL | drop(reference1);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:24:10 --> $DIR/drop_forget_ref.rs:24:10
| |
LL | drop(reference1); LL | drop(reference1);
@ -114,7 +114,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(&*reference1); LL | forget(&*reference1);
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:25:12 --> $DIR/drop_forget_ref.rs:25:12
| |
LL | forget(&*reference1); LL | forget(&*reference1);
@ -126,7 +126,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(reference2); LL | drop(reference2);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: argument has type &mut SomeStruct note: argument has type `&mut SomeStruct`
--> $DIR/drop_forget_ref.rs:28:10 --> $DIR/drop_forget_ref.rs:28:10
| |
LL | drop(reference2); LL | drop(reference2);
@ -138,7 +138,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(reference3); LL | forget(reference3);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
note: argument has type &mut SomeStruct note: argument has type `&mut SomeStruct`
--> $DIR/drop_forget_ref.rs:30:12 --> $DIR/drop_forget_ref.rs:30:12
| |
LL | forget(reference3); LL | forget(reference3);
@ -150,7 +150,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(reference4); LL | drop(reference4);
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:33:10 --> $DIR/drop_forget_ref.rs:33:10
| |
LL | drop(reference4); LL | drop(reference4);
@ -162,7 +162,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(reference4); LL | forget(reference4);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:34:12 --> $DIR/drop_forget_ref.rs:34:12
| |
LL | forget(reference4); LL | forget(reference4);
@ -174,7 +174,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | drop(&val); LL | drop(&val);
| ^^^^^^^^^^ | ^^^^^^^^^^
| |
note: argument has type &T note: argument has type `&T`
--> $DIR/drop_forget_ref.rs:39:10 --> $DIR/drop_forget_ref.rs:39:10
| |
LL | drop(&val); LL | drop(&val);
@ -186,7 +186,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | forget(&val); LL | forget(&val);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
note: argument has type &T note: argument has type `&T`
--> $DIR/drop_forget_ref.rs:45:12 --> $DIR/drop_forget_ref.rs:45:12
| |
LL | forget(&val); LL | forget(&val);
@ -198,7 +198,7 @@ error: calls to `std::mem::drop` with a reference instead of an owned value. Dro
LL | std::mem::drop(&SomeStruct); LL | std::mem::drop(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:53:20 --> $DIR/drop_forget_ref.rs:53:20
| |
LL | std::mem::drop(&SomeStruct); LL | std::mem::drop(&SomeStruct);
@ -210,7 +210,7 @@ error: calls to `std::mem::forget` with a reference instead of an owned value. F
LL | std::mem::forget(&SomeStruct); LL | std::mem::forget(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: argument has type &SomeStruct note: argument has type `&SomeStruct`
--> $DIR/drop_forget_ref.rs:56:22 --> $DIR/drop_forget_ref.rs:56:22
| |
LL | std::mem::forget(&SomeStruct); LL | std::mem::forget(&SomeStruct);

View File

@ -1,4 +1,4 @@
error: if expression with an `else if`, but without a final `else` error: `if` expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:45:12 --> $DIR/else_if_without_else.rs:45:12
| |
LL | } else if bla2() { LL | } else if bla2() {
@ -11,7 +11,7 @@ LL | | }
= note: `-D clippy::else-if-without-else` implied by `-D warnings` = note: `-D clippy::else-if-without-else` implied by `-D warnings`
= help: add an `else` block here = help: add an `else` block here
error: if expression with an `else if`, but without a final `else` error: `if` expression with an `else if`, but without a final `else`
--> $DIR/else_if_without_else.rs:54:12 --> $DIR/else_if_without_else.rs:54:12
| |
LL | } else if bla3() { LL | } else if bla3() {

View File

@ -1,4 +1,4 @@
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:7:1 --> $DIR/empty_line_after_outer_attribute.rs:7:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]
@ -9,7 +9,7 @@ LL | | fn with_one_newline_and_comment() { assert!(true) }
| |
= note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings` = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings`
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:19:1 --> $DIR/empty_line_after_outer_attribute.rs:19:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]
@ -17,7 +17,7 @@ LL | |
LL | | fn with_one_newline() { assert!(true) } LL | | fn with_one_newline() { assert!(true) }
| |_ | |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:24:1 --> $DIR/empty_line_after_outer_attribute.rs:24:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]
@ -26,7 +26,7 @@ LL | |
LL | | fn with_two_newlines() { assert!(true) } LL | | fn with_two_newlines() { assert!(true) }
| |_ | |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:31:1 --> $DIR/empty_line_after_outer_attribute.rs:31:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]
@ -34,7 +34,7 @@ LL | |
LL | | enum Baz { LL | | enum Baz {
| |_ | |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:39:1 --> $DIR/empty_line_after_outer_attribute.rs:39:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]
@ -42,7 +42,7 @@ LL | |
LL | | struct Foo { LL | | struct Foo {
| |_ | |_
error: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute? error: Found an empty line after an outer attribute. Perhaps you forgot to add a `!` to make it an inner attribute?
--> $DIR/empty_line_after_outer_attribute.rs:47:1 --> $DIR/empty_line_after_outer_attribute.rs:47:1
| |
LL | / #[crate_type = "lib"] LL | / #[crate_type = "lib"]

View File

@ -1,4 +1,4 @@
error: used expect() on an Option value. If this value is an None it will panic error: used `expect()` on `an Option` value. If this value is an `None` it will panic
--> $DIR/expect.rs:5:13 --> $DIR/expect.rs:5:13
| |
LL | let _ = opt.expect(""); LL | let _ = opt.expect("");
@ -6,7 +6,7 @@ LL | let _ = opt.expect("");
| |
= note: `-D clippy::option-expect-used` implied by `-D warnings` = note: `-D clippy::option-expect-used` implied by `-D warnings`
error: used expect() on a Result value. If this value is an Err it will panic error: used `expect()` on `a Result` value. If this value is an `Err` it will panic
--> $DIR/expect.rs:10:13 --> $DIR/expect.rs:10:13
| |
LL | let _ = res.expect(""); LL | let _ = res.expect("");

View File

@ -1,35 +1,35 @@
error: strict comparison of f32 or f64 error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:59:5 --> $DIR/float_cmp.rs:59:5
| |
LL | ONE as f64 != 2.0; LL | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error` | ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
| |
= note: `-D clippy::float-cmp` implied by `-D warnings` = note: `-D clippy::float-cmp` implied by `-D warnings`
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp.rs:59:5 --> $DIR/float_cmp.rs:59:5
| |
LL | ONE as f64 != 2.0; LL | ONE as f64 != 2.0;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: strict comparison of f32 or f64 error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:64:5 --> $DIR/float_cmp.rs:64:5
| |
LL | x == 1.0; LL | x == 1.0;
| ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error` | ^^^^^^^^ help: consider comparing them within some error: `(x - 1.0).abs() < error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp.rs:64:5 --> $DIR/float_cmp.rs:64:5
| |
LL | x == 1.0; LL | x == 1.0;
| ^^^^^^^^ | ^^^^^^^^
error: strict comparison of f32 or f64 error: strict comparison of `f32` or `f64`
--> $DIR/float_cmp.rs:67:5 --> $DIR/float_cmp.rs:67:5
| |
LL | twice(x) != twice(ONE as f64); LL | twice(x) != twice(ONE as f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp.rs:67:5 --> $DIR/float_cmp.rs:67:5
| |
LL | twice(x) != twice(ONE as f64); LL | twice(x) != twice(ONE as f64);

View File

@ -1,83 +1,83 @@
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:20:5 --> $DIR/float_cmp_const.rs:20:5
| |
LL | 1f32 == ONE; LL | 1f32 == ONE;
| ^^^^^^^^^^^ help: consider comparing them within some error: `(1f32 - ONE).abs() < error` | ^^^^^^^^^^^ help: consider comparing them within some error: `(1f32 - ONE).abs() < error`
| |
= note: `-D clippy::float-cmp-const` implied by `-D warnings` = note: `-D clippy::float-cmp-const` implied by `-D warnings`
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:20:5 --> $DIR/float_cmp_const.rs:20:5
| |
LL | 1f32 == ONE; LL | 1f32 == ONE;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:21:5 --> $DIR/float_cmp_const.rs:21:5
| |
LL | TWO == ONE; LL | TWO == ONE;
| ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error` | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:21:5 --> $DIR/float_cmp_const.rs:21:5
| |
LL | TWO == ONE; LL | TWO == ONE;
| ^^^^^^^^^^ | ^^^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:22:5 --> $DIR/float_cmp_const.rs:22:5
| |
LL | TWO != ONE; LL | TWO != ONE;
| ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() > error` | ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() > error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:22:5 --> $DIR/float_cmp_const.rs:22:5
| |
LL | TWO != ONE; LL | TWO != ONE;
| ^^^^^^^^^^ | ^^^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:23:5 --> $DIR/float_cmp_const.rs:23:5
| |
LL | ONE + ONE == TWO; LL | ONE + ONE == TWO;
| ^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE + ONE - TWO).abs() < error` | ^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE + ONE - TWO).abs() < error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:23:5 --> $DIR/float_cmp_const.rs:23:5
| |
LL | ONE + ONE == TWO; LL | ONE + ONE == TWO;
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:25:5 --> $DIR/float_cmp_const.rs:25:5
| |
LL | x as f32 == ONE; LL | x as f32 == ONE;
| ^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(x as f32 - ONE).abs() < error` | ^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(x as f32 - ONE).abs() < error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:25:5 --> $DIR/float_cmp_const.rs:25:5
| |
LL | x as f32 == ONE; LL | x as f32 == ONE;
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:28:5 --> $DIR/float_cmp_const.rs:28:5
| |
LL | v == ONE; LL | v == ONE;
| ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error` | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:28:5 --> $DIR/float_cmp_const.rs:28:5
| |
LL | v == ONE; LL | v == ONE;
| ^^^^^^^^ | ^^^^^^^^
error: strict comparison of f32 or f64 constant error: strict comparison of `f32` or `f64` constant
--> $DIR/float_cmp_const.rs:29:5 --> $DIR/float_cmp_const.rs:29:5
| |
LL | v != ONE; LL | v != ONE;
| ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() > error` | ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() > error`
| |
note: std::f32::EPSILON and std::f64::EPSILON are available. note: `std::f32::EPSILON` and `std::f64::EPSILON` are available.
--> $DIR/float_cmp_const.rs:29:5 --> $DIR/float_cmp_const.rs:29:5
| |
LL | v != ONE; LL | v != ONE;

View File

@ -68,7 +68,7 @@ error: it is more concise to loop over references to containers instead of using
LL | for _v in vec.iter_mut() {} LL | for _v in vec.iter_mut() {}
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec` | ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
error: it is more concise to loop over containers instead of using explicit iteration methods` error: it is more concise to loop over containers instead of using explicit iteration methods
--> $DIR/for_loop_fixable.rs:103:15 --> $DIR/for_loop_fixable.rs:103:15
| |
LL | for _v in out_vec.into_iter() {} LL | for _v in out_vec.into_iter() {}
@ -130,7 +130,7 @@ error: it is more concise to loop over references to containers instead of using
LL | for _v in bs.iter() {} LL | for _v in bs.iter() {}
| ^^^^^^^^^ help: to write this more concisely, try: `&bs` | ^^^^^^^^^ help: to write this more concisely, try: `&bs`
error: it is more concise to loop over containers instead of using explicit iteration methods` error: it is more concise to loop over containers instead of using explicit iteration methods
--> $DIR/for_loop_fixable.rs:310:18 --> $DIR/for_loop_fixable.rs:310:18
| |
LL | for i in iterator.into_iter() { LL | for i in iterator.into_iter() {
@ -142,7 +142,7 @@ error: it is more concise to loop over references to containers instead of using
LL | for _ in t.into_iter() {} LL | for _ in t.into_iter() {}
| ^^^^^^^^^^^^^ help: to write this more concisely, try: `&t` | ^^^^^^^^^^^^^ help: to write this more concisely, try: `&t`
error: it is more concise to loop over containers instead of using explicit iteration methods` error: it is more concise to loop over containers instead of using explicit iteration methods
--> $DIR/for_loop_fixable.rs:332:18 --> $DIR/for_loop_fixable.rs:332:18
| |
LL | for _ in r.into_iter() {} LL | for _ in r.into_iter() {}

View File

@ -2,7 +2,7 @@ error: useless use of `format!`
--> $DIR/format.rs:13:5 --> $DIR/format.rs:13:5
| |
LL | format!("foo"); LL | format!("foo");
| ^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` | ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string();`
| |
= note: `-D clippy::useless-format` implied by `-D warnings` = note: `-D clippy::useless-format` implied by `-D warnings`
@ -10,13 +10,13 @@ error: useless use of `format!`
--> $DIR/format.rs:14:5 --> $DIR/format.rs:14:5
| |
LL | format!("{{}}"); LL | format!("{{}}");
| ^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"{}".to_string();` | ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:15:5 --> $DIR/format.rs:15:5
| |
LL | format!("{{}} abc {{}}"); LL | format!("{{}} abc {{}}");
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"{} abc {}".to_string();` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:16:5 --> $DIR/format.rs:16:5
@ -25,61 +25,61 @@ LL | / format!(
LL | | r##"foo {{}} LL | | r##"foo {{}}
LL | | " bar"## LL | | " bar"##
LL | | ); LL | | );
| |______^ help: consider using .to_string(): `"foo {}/n/" bar".to_string();` | |______^ help: consider using `.to_string()`: `"foo {}/n/" bar".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:21:5 --> $DIR/format.rs:21:5
| |
LL | format!("{}", "foo"); LL | format!("{}", "foo");
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:25:5 --> $DIR/format.rs:25:5
| |
LL | format!("{:+}", "foo"); // Warn when the format makes no difference. LL | format!("{:+}", "foo"); // Warn when the format makes no difference.
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:26:5 --> $DIR/format.rs:26:5
| |
LL | format!("{:<}", "foo"); // Warn when the format makes no difference. LL | format!("{:<}", "foo"); // Warn when the format makes no difference.
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();` | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:31:5 --> $DIR/format.rs:31:5
| |
LL | format!("{}", arg); LL | format!("{}", arg);
| ^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();` | ^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:35:5 --> $DIR/format.rs:35:5
| |
LL | format!("{:+}", arg); // Warn when the format makes no difference. LL | format!("{:+}", arg); // Warn when the format makes no difference.
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();` | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:36:5 --> $DIR/format.rs:36:5
| |
LL | format!("{:<}", arg); // Warn when the format makes no difference. LL | format!("{:<}", arg); // Warn when the format makes no difference.
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `arg.to_string();` | ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:63:5 --> $DIR/format.rs:63:5
| |
LL | format!("{}", 42.to_string()); LL | format!("{}", 42.to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `42.to_string();` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:65:5 --> $DIR/format.rs:65:5
| |
LL | format!("{}", x.display().to_string()); LL | format!("{}", x.display().to_string());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `x.display().to_string();` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string();`
error: useless use of `format!` error: useless use of `format!`
--> $DIR/format.rs:69:18 --> $DIR/format.rs:69:18
| |
LL | let _ = Some(format!("{}", a + "bar")); LL | let _ = Some(format!("{}", a + "bar"));
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `a + "bar"` | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a + "bar"`
error: aborting due to 13 previous errors error: aborting due to 13 previous errors

View File

@ -9,7 +9,7 @@ LL | | }
| |_____^ | |_____^
| |
= note: `-D clippy::if-not-else` implied by `-D warnings` = note: `-D clippy::if-not-else` implied by `-D warnings`
= help: remove the `!` and swap the blocks of the if/else = help: remove the `!` and swap the blocks of the `if`/`else`
error: Unnecessary `!=` operation error: Unnecessary `!=` operation
--> $DIR/if_not_else.rs:14:5 --> $DIR/if_not_else.rs:14:5
@ -21,7 +21,7 @@ LL | | println!("Bunny");
LL | | } LL | | }
| |_____^ | |_____^
| |
= help: change to `==` and swap the blocks of the if/else = help: change to `==` and swap the blocks of the `if`/`else`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -230,7 +230,7 @@ LL | | return Ok(&foo[0..]);
LL | | } else { LL | | } else {
| |_____^ | |_____^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous `if`
--> $DIR/if_same_then_else.rs:241:15 --> $DIR/if_same_then_else.rs:241:15
| |
LL | } else if true { LL | } else if true {

View File

@ -1,4 +1,4 @@
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous `if`
--> $DIR/ifs_same_cond.rs:9:15 --> $DIR/ifs_same_cond.rs:9:15
| |
LL | } else if b { LL | } else if b {
@ -11,7 +11,7 @@ note: same as this
LL | if b { LL | if b {
| ^ | ^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous `if`
--> $DIR/ifs_same_cond.rs:14:15 --> $DIR/ifs_same_cond.rs:14:15
| |
LL | } else if a == 1 { LL | } else if a == 1 {
@ -23,7 +23,7 @@ note: same as this
LL | if a == 1 { LL | if a == 1 {
| ^^^^^^ | ^^^^^^
error: this `if` has the same condition as a previous if error: this `if` has the same condition as a previous `if`
--> $DIR/ifs_same_cond.rs:20:15 --> $DIR/ifs_same_cond.rs:20:15
| |
LL | } else if 2 * a == 1 { LL | } else if 2 * a == 1 {

View File

@ -1,4 +1,4 @@
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:12:5 --> $DIR/implicit_return.rs:12:5
| |
LL | true LL | true
@ -6,61 +6,61 @@ LL | true
| |
= note: `-D clippy::implicit-return` implied by `-D warnings` = note: `-D clippy::implicit-return` implied by `-D warnings`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:18:9 --> $DIR/implicit_return.rs:18:9
| |
LL | true LL | true
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:20:9 --> $DIR/implicit_return.rs:20:9
| |
LL | false LL | false
| ^^^^^ help: add `return` as shown: `return false` | ^^^^^ help: add `return` as shown: `return false`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:28:17 --> $DIR/implicit_return.rs:28:17
| |
LL | true => false, LL | true => false,
| ^^^^^ help: add `return` as shown: `return false` | ^^^^^ help: add `return` as shown: `return false`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:29:20 --> $DIR/implicit_return.rs:29:20
| |
LL | false => { true }, LL | false => { true },
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:44:9 --> $DIR/implicit_return.rs:44:9
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:52:13 --> $DIR/implicit_return.rs:52:13
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:61:13 --> $DIR/implicit_return.rs:61:13
| |
LL | break true; LL | break true;
| ^^^^^^^^^^ help: change `break` to `return` as shown: `return true` | ^^^^^^^^^^ help: change `break` to `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:79:18 --> $DIR/implicit_return.rs:79:18
| |
LL | let _ = || { true }; LL | let _ = || { true };
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:80:16 --> $DIR/implicit_return.rs:80:16
| |
LL | let _ = || true; LL | let _ = || true;
| ^^^^ help: add `return` as shown: `return true` | ^^^^ help: add `return` as shown: `return true`
error: missing return statement error: missing `return` statement
--> $DIR/implicit_return.rs:88:5 --> $DIR/implicit_return.rs:88:5
| |
LL | format!("test {}", "test") LL | format!("test {}", "test")

View File

@ -1,4 +1,4 @@
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:18:5 --> $DIR/infallible_destructuring_match.rs:18:5
| |
LL | / let data = match wrapper { LL | / let data = match wrapper {
@ -8,7 +8,7 @@ LL | | };
| |
= note: `-D clippy::infallible-destructuring-match` implied by `-D warnings` = note: `-D clippy::infallible-destructuring-match` implied by `-D warnings`
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:39:5 --> $DIR/infallible_destructuring_match.rs:39:5
| |
LL | / let data = match wrapper { LL | / let data = match wrapper {
@ -16,7 +16,7 @@ LL | | TupleStruct(i) => i,
LL | | }; LL | | };
| |______^ help: try this: `let TupleStruct(data) = wrapper;` | |______^ help: try this: `let TupleStruct(data) = wrapper;`
error: you seem to be trying to use match to destructure a single infallible pattern. Consider using `let` error: you seem to be trying to use `match` to destructure a single infallible pattern. Consider using `let`
--> $DIR/infallible_destructuring_match.rs:60:5 --> $DIR/infallible_destructuring_match.rs:60:5
| |
LL | / let data = match wrapper { LL | / let data = match wrapper {

View File

@ -1,4 +1,4 @@
error: this .into_iter() call is equivalent to .iter() and will not move the Vec error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `Vec`
--> $DIR/into_iter_on_ref.rs:14:30 --> $DIR/into_iter_on_ref.rs:14:30
| |
LL | let _ = (&vec![1, 2, 3]).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&vec![1, 2, 3]).into_iter(); //~ WARN equivalent to .iter()
@ -6,151 +6,151 @@ LL | let _ = (&vec![1, 2, 3]).into_iter(); //~ WARN equivalent to .iter()
| |
= note: `-D clippy::into-iter-on-ref` implied by `-D warnings` = note: `-D clippy::into-iter-on-ref` implied by `-D warnings`
error: this .into_iter() call is equivalent to .iter() and will not move the slice error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `slice`
--> $DIR/into_iter_on_ref.rs:15:46 --> $DIR/into_iter_on_ref.rs:15:46
| |
LL | let _ = vec![1, 2, 3].into_boxed_slice().into_iter(); //~ WARN equivalent to .iter() LL | let _ = vec![1, 2, 3].into_boxed_slice().into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the slice error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `slice`
--> $DIR/into_iter_on_ref.rs:16:41 --> $DIR/into_iter_on_ref.rs:16:41
| |
LL | let _ = std::rc::Rc::from(&[X][..]).into_iter(); //~ WARN equivalent to .iter() LL | let _ = std::rc::Rc::from(&[X][..]).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the slice error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `slice`
--> $DIR/into_iter_on_ref.rs:17:44 --> $DIR/into_iter_on_ref.rs:17:44
| |
LL | let _ = std::sync::Arc::from(&[X][..]).into_iter(); //~ WARN equivalent to .iter() LL | let _ = std::sync::Arc::from(&[X][..]).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the array error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `array`
--> $DIR/into_iter_on_ref.rs:19:32 --> $DIR/into_iter_on_ref.rs:19:32
| |
LL | let _ = (&&&&&&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter() LL | let _ = (&&&&&&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the array error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `array`
--> $DIR/into_iter_on_ref.rs:20:36 --> $DIR/into_iter_on_ref.rs:20:36
| |
LL | let _ = (&&&&mut &&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter() LL | let _ = (&&&&mut &&&[1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the array error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `array`
--> $DIR/into_iter_on_ref.rs:21:40 --> $DIR/into_iter_on_ref.rs:21:40
| |
LL | let _ = (&mut &mut &mut [1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter_mut() LL | let _ = (&mut &mut &mut [1, 2, 3]).into_iter(); //~ ERROR equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the Option error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `Option`
--> $DIR/into_iter_on_ref.rs:23:24 --> $DIR/into_iter_on_ref.rs:23:24
| |
LL | let _ = (&Some(4)).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&Some(4)).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the Option error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `Option`
--> $DIR/into_iter_on_ref.rs:24:28 --> $DIR/into_iter_on_ref.rs:24:28
| |
LL | let _ = (&mut Some(5)).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut Some(5)).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the Result error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `Result`
--> $DIR/into_iter_on_ref.rs:25:32 --> $DIR/into_iter_on_ref.rs:25:32
| |
LL | let _ = (&Ok::<_, i32>(6)).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&Ok::<_, i32>(6)).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the Result error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `Result`
--> $DIR/into_iter_on_ref.rs:26:37 --> $DIR/into_iter_on_ref.rs:26:37
| |
LL | let _ = (&mut Err::<i32, _>(7)).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut Err::<i32, _>(7)).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the Vec error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `Vec`
--> $DIR/into_iter_on_ref.rs:27:34 --> $DIR/into_iter_on_ref.rs:27:34
| |
LL | let _ = (&Vec::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&Vec::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the Vec error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `Vec`
--> $DIR/into_iter_on_ref.rs:28:38 --> $DIR/into_iter_on_ref.rs:28:38
| |
LL | let _ = (&mut Vec::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut Vec::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the BTreeMap error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `BTreeMap`
--> $DIR/into_iter_on_ref.rs:29:44 --> $DIR/into_iter_on_ref.rs:29:44
| |
LL | let _ = (&BTreeMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&BTreeMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the BTreeMap error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `BTreeMap`
--> $DIR/into_iter_on_ref.rs:30:48 --> $DIR/into_iter_on_ref.rs:30:48
| |
LL | let _ = (&mut BTreeMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut BTreeMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the VecDeque error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `VecDeque`
--> $DIR/into_iter_on_ref.rs:31:39 --> $DIR/into_iter_on_ref.rs:31:39
| |
LL | let _ = (&VecDeque::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&VecDeque::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the VecDeque error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `VecDeque`
--> $DIR/into_iter_on_ref.rs:32:43 --> $DIR/into_iter_on_ref.rs:32:43
| |
LL | let _ = (&mut VecDeque::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut VecDeque::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the LinkedList error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `LinkedList`
--> $DIR/into_iter_on_ref.rs:33:41 --> $DIR/into_iter_on_ref.rs:33:41
| |
LL | let _ = (&LinkedList::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&LinkedList::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the LinkedList error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `LinkedList`
--> $DIR/into_iter_on_ref.rs:34:45 --> $DIR/into_iter_on_ref.rs:34:45
| |
LL | let _ = (&mut LinkedList::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut LinkedList::<i32>::new()).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the HashMap error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `HashMap`
--> $DIR/into_iter_on_ref.rs:35:43 --> $DIR/into_iter_on_ref.rs:35:43
| |
LL | let _ = (&HashMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&HashMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter_mut() and will not move the HashMap error: this `.into_iter()` call is equivalent to `.iter_mut()` and will not move the `HashMap`
--> $DIR/into_iter_on_ref.rs:36:47 --> $DIR/into_iter_on_ref.rs:36:47
| |
LL | let _ = (&mut HashMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter_mut() LL | let _ = (&mut HashMap::<i32, u64>::new()).into_iter(); //~ WARN equivalent to .iter_mut()
| ^^^^^^^^^ help: call directly: `iter_mut` | ^^^^^^^^^ help: call directly: `iter_mut`
error: this .into_iter() call is equivalent to .iter() and will not move the BTreeSet error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `BTreeSet`
--> $DIR/into_iter_on_ref.rs:38:39 --> $DIR/into_iter_on_ref.rs:38:39
| |
LL | let _ = (&BTreeSet::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&BTreeSet::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the BinaryHeap error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `BinaryHeap`
--> $DIR/into_iter_on_ref.rs:39:41 --> $DIR/into_iter_on_ref.rs:39:41
| |
LL | let _ = (&BinaryHeap::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&BinaryHeap::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the HashSet error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `HashSet`
--> $DIR/into_iter_on_ref.rs:40:38 --> $DIR/into_iter_on_ref.rs:40:38
| |
LL | let _ = (&HashSet::<i32>::new()).into_iter(); //~ WARN equivalent to .iter() LL | let _ = (&HashSet::<i32>::new()).into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the Path error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `Path`
--> $DIR/into_iter_on_ref.rs:41:43 --> $DIR/into_iter_on_ref.rs:41:43
| |
LL | let _ = std::path::Path::new("12/34").into_iter(); //~ WARN equivalent to .iter() LL | let _ = std::path::Path::new("12/34").into_iter(); //~ WARN equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter` | ^^^^^^^^^ help: call directly: `iter`
error: this .into_iter() call is equivalent to .iter() and will not move the PathBuf error: this `.into_iter()` call is equivalent to `.iter()` and will not move the `PathBuf`
--> $DIR/into_iter_on_ref.rs:42:47 --> $DIR/into_iter_on_ref.rs:42:47
| |
LL | let _ = std::path::PathBuf::from("12/34").into_iter(); //~ ERROR equivalent to .iter() LL | let _ = std::path::PathBuf::from("12/34").into_iter(); //~ ERROR equivalent to .iter()

View File

@ -5,7 +5,7 @@ LL | [0u32; 20_000_000],
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::large-stack-arrays` implied by `-D warnings` = note: `-D clippy::large-stack-arrays` implied by `-D warnings`
= help: consider allocating on the heap with vec![0u32; 20_000_000].into_boxed_slice() = help: consider allocating on the heap with `vec![0u32; 20_000_000].into_boxed_slice()`
error: allocating a local array larger than 512000 bytes error: allocating a local array larger than 512000 bytes
--> $DIR/large_stack_arrays.rs:18:9 --> $DIR/large_stack_arrays.rs:18:9
@ -13,7 +13,7 @@ error: allocating a local array larger than 512000 bytes
LL | [S { data: [0; 32] }; 5000], LL | [S { data: [0; 32] }; 5000],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: consider allocating on the heap with vec![S { data: [0; 32] }; 5000].into_boxed_slice() = help: consider allocating on the heap with `vec![S { data: [0; 32] }; 5000].into_boxed_slice()`
error: allocating a local array larger than 512000 bytes error: allocating a local array larger than 512000 bytes
--> $DIR/large_stack_arrays.rs:19:9 --> $DIR/large_stack_arrays.rs:19:9
@ -21,7 +21,7 @@ error: allocating a local array larger than 512000 bytes
LL | [Some(""); 20_000_000], LL | [Some(""); 20_000_000],
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
| |
= help: consider allocating on the heap with vec![Some(""); 20_000_000].into_boxed_slice() = help: consider allocating on the heap with `vec![Some(""); 20_000_000].into_boxed_slice()`
error: allocating a local array larger than 512000 bytes error: allocating a local array larger than 512000 bytes
--> $DIR/large_stack_arrays.rs:20:9 --> $DIR/large_stack_arrays.rs:20:9
@ -29,7 +29,7 @@ error: allocating a local array larger than 512000 bytes
LL | [E::T(0); 5000], LL | [E::T(0); 5000],
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
= help: consider allocating on the heap with vec![E::T(0); 5000].into_boxed_slice() = help: consider allocating on the heap with `vec![E::T(0); 5000].into_boxed_slice()`
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View File

@ -1,8 +1,8 @@
error: returning the result of a let binding from a block error: returning the result of a `let` binding from a block
--> $DIR/let_return.rs:7:5 --> $DIR/let_return.rs:7:5
| |
LL | let x = 5; LL | let x = 5;
| ---------- unnecessary let binding | ---------- unnecessary `let` binding
LL | x LL | x
| ^ | ^
| |
@ -13,11 +13,11 @@ LL |
LL | 5 LL | 5
| |
error: returning the result of a let binding from a block error: returning the result of a `let` binding from a block
--> $DIR/let_return.rs:13:9 --> $DIR/let_return.rs:13:9
| |
LL | let x = 5; LL | let x = 5;
| ---------- unnecessary let binding | ---------- unnecessary `let` binding
LL | x LL | x
| ^ | ^
| |

View File

@ -1,4 +1,4 @@
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:59:5 --> $DIR/let_underscore.rs:59:5
| |
LL | let _ = f(); LL | let _ = f();
@ -7,7 +7,7 @@ LL | let _ = f();
= note: `-D clippy::let-underscore-must-use` implied by `-D warnings` = note: `-D clippy::let-underscore-must-use` implied by `-D warnings`
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:60:5 --> $DIR/let_underscore.rs:60:5
| |
LL | let _ = g(); LL | let _ = g();
@ -15,7 +15,7 @@ LL | let _ = g();
| |
= help: consider explicitly using expression value = help: consider explicitly using expression value
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:62:5 --> $DIR/let_underscore.rs:62:5
| |
LL | let _ = l(0_u32); LL | let _ = l(0_u32);
@ -23,7 +23,7 @@ LL | let _ = l(0_u32);
| |
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:66:5 --> $DIR/let_underscore.rs:66:5
| |
LL | let _ = s.f(); LL | let _ = s.f();
@ -31,7 +31,7 @@ LL | let _ = s.f();
| |
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:67:5 --> $DIR/let_underscore.rs:67:5
| |
LL | let _ = s.g(); LL | let _ = s.g();
@ -39,7 +39,7 @@ LL | let _ = s.g();
| |
= help: consider explicitly using expression value = help: consider explicitly using expression value
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:70:5 --> $DIR/let_underscore.rs:70:5
| |
LL | let _ = S::h(); LL | let _ = S::h();
@ -47,7 +47,7 @@ LL | let _ = S::h();
| |
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:71:5 --> $DIR/let_underscore.rs:71:5
| |
LL | let _ = S::p(); LL | let _ = S::p();
@ -55,7 +55,7 @@ LL | let _ = S::p();
| |
= help: consider explicitly using expression value = help: consider explicitly using expression value
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:73:5 --> $DIR/let_underscore.rs:73:5
| |
LL | let _ = S::a(); LL | let _ = S::a();
@ -63,7 +63,7 @@ LL | let _ = S::a();
| |
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:75:5 --> $DIR/let_underscore.rs:75:5
| |
LL | let _ = if true { Ok(()) } else { Err(()) }; LL | let _ = if true { Ok(()) } else { Err(()) };
@ -71,7 +71,7 @@ LL | let _ = if true { Ok(()) } else { Err(()) };
| |
= help: consider explicitly using expression value = help: consider explicitly using expression value
error: non-binding let on a result of a #[must_use] function error: non-binding let on a result of a `#[must_use]` function
--> $DIR/let_underscore.rs:79:5 --> $DIR/let_underscore.rs:79:5
| |
LL | let _ = a.is_ok(); LL | let _ = a.is_ok();
@ -79,7 +79,7 @@ LL | let _ = a.is_ok();
| |
= help: consider explicitly using function result = help: consider explicitly using function result
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:81:5 --> $DIR/let_underscore.rs:81:5
| |
LL | let _ = a.map(|_| ()); LL | let _ = a.map(|_| ());
@ -87,7 +87,7 @@ LL | let _ = a.map(|_| ());
| |
= help: consider explicitly using expression value = help: consider explicitly using expression value
error: non-binding let on an expression with #[must_use] type error: non-binding let on an expression with `#[must_use]` type
--> $DIR/let_underscore.rs:83:5 --> $DIR/let_underscore.rs:83:5
| |
LL | let _ = a; LL | let _ = a;

View File

@ -34,7 +34,7 @@ error: You are needlessly cloning iterator elements
--> $DIR/map_clone.rs:25:29 --> $DIR/map_clone.rs:25:29
| |
LL | let _ = std::env::args().map(|v| v.clone()); LL | let _ = std::env::args().map(|v| v.clone());
| ^^^^^^^^^^^^^^^^^^^ help: Remove the map call | ^^^^^^^^^^^^^^^^^^^ help: Remove the `map` call
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -2,7 +2,7 @@ error: called `map(..).flatten()` on an `Iterator`. This is more succinctly expr
--> $DIR/map_flatten.rs:7:21 --> $DIR/map_flatten.rs:7:21
| |
LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); LL | let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using flat_map instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `vec![5_i8; 6].into_iter().flat_map(|x| 0..x)`
| |
= note: `-D clippy::map-flatten` implied by `-D warnings` = note: `-D clippy::map-flatten` implied by `-D warnings`

View File

@ -1,4 +1,4 @@
error: use as_ref() instead error: use `as_ref()` instead
--> $DIR/match_as_ref.rs:8:33 --> $DIR/match_as_ref.rs:8:33
| |
LL | let borrowed: Option<&()> = match owned { LL | let borrowed: Option<&()> = match owned {
@ -10,7 +10,7 @@ LL | | };
| |
= note: `-D clippy::match-as-ref` implied by `-D warnings` = note: `-D clippy::match-as-ref` implied by `-D warnings`
error: use as_mut() instead error: use `as_mut()` instead
--> $DIR/match_as_ref.rs:14:39 --> $DIR/match_as_ref.rs:14:39
| |
LL | let borrow_mut: Option<&mut ()> = match mut_owned { LL | let borrow_mut: Option<&mut ()> = match mut_owned {
@ -20,7 +20,7 @@ LL | | Some(ref mut v) => Some(v),
LL | | }; LL | | };
| |_____^ help: try this: `mut_owned.as_mut()` | |_____^ help: try this: `mut_owned.as_mut()`
error: use as_ref() instead error: use `as_ref()` instead
--> $DIR/match_as_ref.rs:30:13 --> $DIR/match_as_ref.rs:30:13
| |
LL | / match self.source { LL | / match self.source {

View File

@ -13,7 +13,7 @@ LL | / match test {
LL | | true => 0, LL | | true => 0,
LL | | false => 42, LL | | false => 42,
LL | | }; LL | | };
| |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }` | |_____^ help: consider using an `if`/`else` expression: `if test { 0 } else { 42 }`
| |
= note: `-D clippy::match-bool` implied by `-D warnings` = note: `-D clippy::match-bool` implied by `-D warnings`
@ -24,7 +24,7 @@ LL | / match option == 1 {
LL | | true => 1, LL | | true => 1,
LL | | false => 0, LL | | false => 0,
LL | | }; LL | | };
| |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }` | |_____^ help: consider using an `if`/`else` expression: `if option == 1 { 1 } else { 0 }`
error: you seem to be trying to match on a boolean expression error: you seem to be trying to match on a boolean expression
--> $DIR/match_bool.rs:15:5 --> $DIR/match_bool.rs:15:5
@ -37,7 +37,7 @@ LL | | },
LL | | }; LL | | };
| |_____^ | |_____^
| |
help: consider using an if/else expression help: consider using an `if`/`else` expression
| |
LL | if !test { LL | if !test {
LL | println!("Noooo!"); LL | println!("Noooo!");
@ -55,7 +55,7 @@ LL | | _ => (),
LL | | }; LL | | };
| |_____^ | |_____^
| |
help: consider using an if/else expression help: consider using an `if`/`else` expression
| |
LL | if !test { LL | if !test {
LL | println!("Noooo!"); LL | println!("Noooo!");
@ -73,7 +73,7 @@ LL | | _ => (),
LL | | }; LL | | };
| |_____^ | |_____^
| |
help: consider using an if/else expression help: consider using an `if`/`else` expression
| |
LL | if !(test && test) { LL | if !(test && test) {
LL | println!("Noooo!"); LL | println!("Noooo!");
@ -100,7 +100,7 @@ LL | | },
LL | | }; LL | | };
| |_____^ | |_____^
| |
help: consider using an if/else expression help: consider using an `if`/`else` expression
| |
LL | if test { LL | if test {
LL | println!("Yes!"); LL | println!("Yes!");

View File

@ -24,7 +24,7 @@ LL | | if true {
LL | | a LL | | a
LL | | }, LL | | },
| |_________^ | |_________^
note: `42` has the same arm body as the `_` wildcard, consider removing it` note: `42` has the same arm body as the `_` wildcard, consider removing it
--> $DIR/match_same_arms.rs:28:15 --> $DIR/match_same_arms.rs:28:15
| |
LL | 42 => { LL | 42 => {
@ -48,7 +48,7 @@ note: same as this
| |
LL | Abc::A => 0, LL | Abc::A => 0,
| ^ | ^
note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it` note: `Abc::A` has the same arm body as the `_` wildcard, consider removing it
--> $DIR/match_same_arms.rs:50:19 --> $DIR/match_same_arms.rs:50:19
| |
LL | Abc::A => 0, LL | Abc::A => 0,

View File

@ -1,11 +1,11 @@
error: Err(_) will match all errors, maybe not a good idea error: `Err(_)` will match all errors, maybe not a good idea
--> $DIR/matches.rs:14:9 --> $DIR/matches.rs:14:9
| |
LL | Err(_) => panic!("err"), LL | Err(_) => panic!("err"),
| ^^^^^^ | ^^^^^^
| |
= note: `-D clippy::match-wild-err-arm` implied by `-D warnings` = note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
= note: to remove this warning, match each error separately or use unreachable macro = note: to remove this warning, match each error separately or use `unreachable!` macro
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/matches.rs:13:18 --> $DIR/matches.rs:13:18
@ -26,13 +26,13 @@ LL | Ok(3) => println!("ok"),
| ^^^^^ | ^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: Err(_) will match all errors, maybe not a good idea error: `Err(_)` will match all errors, maybe not a good idea
--> $DIR/matches.rs:20:9 --> $DIR/matches.rs:20:9
| |
LL | Err(_) => panic!(), LL | Err(_) => panic!(),
| ^^^^^^ | ^^^^^^
| |
= note: to remove this warning, match each error separately or use unreachable macro = note: to remove this warning, match each error separately or use `unreachable!` macro
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/matches.rs:19:18 --> $DIR/matches.rs:19:18
@ -52,13 +52,13 @@ LL | Ok(3) => println!("ok"),
| ^^^^^ | ^^^^^
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: Err(_) will match all errors, maybe not a good idea error: `Err(_)` will match all errors, maybe not a good idea
--> $DIR/matches.rs:26:9 --> $DIR/matches.rs:26:9
| |
LL | Err(_) => { LL | Err(_) => {
| ^^^^^^ | ^^^^^^
| |
= note: to remove this warning, match each error separately or use unreachable macro = note: to remove this warning, match each error separately or use `unreachable!` macro
error: this `match` has identical arm bodies error: this `match` has identical arm bodies
--> $DIR/matches.rs:25:18 --> $DIR/matches.rs:25:18

View File

@ -1,4 +1,4 @@
error: usage of mem::forget on Drop type error: usage of `mem::forget` on `Drop` type
--> $DIR/mem_forget.rs:14:5 --> $DIR/mem_forget.rs:14:5
| |
LL | memstuff::forget(six); LL | memstuff::forget(six);
@ -6,13 +6,13 @@ LL | memstuff::forget(six);
| |
= note: `-D clippy::mem-forget` implied by `-D warnings` = note: `-D clippy::mem-forget` implied by `-D warnings`
error: usage of mem::forget on Drop type error: usage of `mem::forget` on `Drop` type
--> $DIR/mem_forget.rs:17:5 --> $DIR/mem_forget.rs:17:5
| |
LL | std::mem::forget(seven); LL | std::mem::forget(seven);
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
error: usage of mem::forget on Drop type error: usage of `mem::forget` on `Drop` type
--> $DIR/mem_forget.rs:20:5 --> $DIR/mem_forget.rs:20:5
| |
LL | forgetSomething(eight); LL | forgetSomething(eight);

View File

@ -1,4 +1,4 @@
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:12:5 --> $DIR/min_max.rs:12:5
| |
LL | min(1, max(3, x)); LL | min(1, max(3, x));
@ -6,37 +6,37 @@ LL | min(1, max(3, x));
| |
= note: `-D clippy::min-max` implied by `-D warnings` = note: `-D clippy::min-max` implied by `-D warnings`
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:13:5 --> $DIR/min_max.rs:13:5
| |
LL | min(max(3, x), 1); LL | min(max(3, x), 1);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:14:5 --> $DIR/min_max.rs:14:5
| |
LL | max(min(x, 1), 3); LL | max(min(x, 1), 3);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:15:5 --> $DIR/min_max.rs:15:5
| |
LL | max(3, min(x, 1)); LL | max(3, min(x, 1));
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:17:5 --> $DIR/min_max.rs:17:5
| |
LL | my_max(3, my_min(x, 1)); LL | my_max(3, my_min(x, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:29:5 --> $DIR/min_max.rs:29:5
| |
LL | min("Apple", max("Zoo", s)); LL | min("Apple", max("Zoo", s));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this min/max combination leads to constant result error: this `min`/`max` combination leads to constant result
--> $DIR/min_max.rs:30:5 --> $DIR/min_max.rs:30:5
| |
LL | max(min(s, "Apple"), "Zoo"); LL | max(min(s, "Apple"), "Zoo");

View File

@ -1,4 +1,4 @@
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:12:5 --> $DIR/could_be_const.rs:12:5
| |
LL | / pub fn new() -> Self { LL | / pub fn new() -> Self {
@ -8,7 +8,7 @@ LL | | }
| |
= note: `-D clippy::missing-const-for-fn` implied by `-D warnings` = note: `-D clippy::missing-const-for-fn` implied by `-D warnings`
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:18:1 --> $DIR/could_be_const.rs:18:1
| |
LL | / fn one() -> i32 { LL | / fn one() -> i32 {
@ -16,7 +16,7 @@ LL | | 1
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:23:1 --> $DIR/could_be_const.rs:23:1
| |
LL | / fn two() -> i32 { LL | / fn two() -> i32 {
@ -25,7 +25,7 @@ LL | | abc
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:30:1 --> $DIR/could_be_const.rs:30:1
| |
LL | / fn string() -> String { LL | / fn string() -> String {
@ -33,7 +33,7 @@ LL | | String::new()
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:35:1 --> $DIR/could_be_const.rs:35:1
| |
LL | / unsafe fn four() -> i32 { LL | / unsafe fn four() -> i32 {
@ -41,7 +41,7 @@ LL | | 4
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:40:1 --> $DIR/could_be_const.rs:40:1
| |
LL | / fn generic<T>(t: T) -> T { LL | / fn generic<T>(t: T) -> T {
@ -49,7 +49,7 @@ LL | | t
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:44:1 --> $DIR/could_be_const.rs:44:1
| |
LL | / fn sub(x: u32) -> usize { LL | / fn sub(x: u32) -> usize {
@ -57,7 +57,7 @@ LL | | unsafe { transmute(&x) }
LL | | } LL | | }
| |_^ | |_^
error: this could be a const_fn error: this could be a `const fn`
--> $DIR/could_be_const.rs:63:9 --> $DIR/could_be_const.rs:63:9
| |
LL | / pub fn b(self, a: &A) -> B { LL | / pub fn b(self, a: &A) -> B {

View File

@ -1,4 +1,4 @@
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add.rs:10:17 --> $DIR/mul_add.rs:10:17
| |
LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c); LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c);
@ -6,25 +6,25 @@ LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c);
| |
= note: `-D clippy::manual-mul-add` implied by `-D warnings` = note: `-D clippy::manual-mul-add` implied by `-D warnings`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add.rs:10:17 --> $DIR/mul_add.rs:10:17
| |
LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c); LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c);
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add.rs:10:31 --> $DIR/mul_add.rs:10:31
| |
LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c); LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c);
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add.rs:10:46 --> $DIR/mul_add.rs:10:46
| |
LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c); LL | let test1 = (a * b + c) * (c + a * b) + (c + (a * b) + c);
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add.rs:11:17 --> $DIR/mul_add.rs:11:17
| |
LL | let test2 = 1234.567 * 45.67834 + 0.0004; LL | let test2 = 1234.567 * 45.67834 + 0.0004;

View File

@ -1,4 +1,4 @@
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:12:17 --> $DIR/mul_add_fixable.rs:12:17
| |
LL | let test1 = a * b + c; LL | let test1 = a * b + c;
@ -6,31 +6,31 @@ LL | let test1 = a * b + c;
| |
= note: `-D clippy::manual-mul-add` implied by `-D warnings` = note: `-D clippy::manual-mul-add` implied by `-D warnings`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:13:17 --> $DIR/mul_add_fixable.rs:13:17
| |
LL | let test2 = c + a * b; LL | let test2 = c + a * b;
| ^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:15:17 --> $DIR/mul_add_fixable.rs:15:17
| |
LL | let test3 = (a * b) + c; LL | let test3 = (a * b) + c;
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:16:17 --> $DIR/mul_add_fixable.rs:16:17
| |
LL | let test4 = c + (a * b); LL | let test4 = c + (a * b);
| ^^^^^^^^^^^ help: try: `a.mul_add(b, c)` | ^^^^^^^^^^^ help: try: `a.mul_add(b, c)`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:18:17 --> $DIR/mul_add_fixable.rs:18:17
| |
LL | let test5 = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c; LL | let test5 = a.mul_add(b, c) * a.mul_add(b, c) + a.mul_add(b, c) + c;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.mul_add(b, c).mul_add(a.mul_add(b, c), a.mul_add(b, c))`
error: consider using mul_add() for better numerical precision error: consider using `mul_add()` for better numerical precision
--> $DIR/mul_add_fixable.rs:19:17 --> $DIR/mul_add_fixable.rs:19:17
| |
LL | let test6 = 1234.567_f64 * 45.67834_f64 + 0.0004_f64; LL | let test6 = 1234.567_f64 * 45.67834_f64 + 0.0004_f64;

View File

@ -1,4 +1,4 @@
error: Consider using an AtomicBool instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicBool` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:6:5 --> $DIR/mutex_atomic.rs:6:5
| |
LL | Mutex::new(true); LL | Mutex::new(true);
@ -6,31 +6,31 @@ LL | Mutex::new(true);
| |
= note: `-D clippy::mutex-atomic` implied by `-D warnings` = note: `-D clippy::mutex-atomic` implied by `-D warnings`
error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicUsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:7:5 --> $DIR/mutex_atomic.rs:7:5
| |
LL | Mutex::new(5usize); LL | Mutex::new(5usize);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicIsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:8:5 --> $DIR/mutex_atomic.rs:8:5
| |
LL | Mutex::new(9isize); LL | Mutex::new(9isize);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicPtr` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:10:5 --> $DIR/mutex_atomic.rs:10:5
| |
LL | Mutex::new(&x as *const u32); LL | Mutex::new(&x as *const u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Consider using an AtomicPtr instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicPtr` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:11:5 --> $DIR/mutex_atomic.rs:11:5
| |
LL | Mutex::new(&mut x as *mut u32); LL | Mutex::new(&mut x as *mut u32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: Consider using an AtomicUsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicUsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:12:5 --> $DIR/mutex_atomic.rs:12:5
| |
LL | Mutex::new(0u32); LL | Mutex::new(0u32);
@ -38,7 +38,7 @@ LL | Mutex::new(0u32);
| |
= note: `-D clippy::mutex-integer` implied by `-D warnings` = note: `-D clippy::mutex-integer` implied by `-D warnings`
error: Consider using an AtomicIsize instead of a Mutex here. If you just want the locking behaviour and not the internal type, consider using Mutex<()>. error: Consider using an `AtomicIsize` instead of a `Mutex` here. If you just want the locking behavior and not the internal type, consider using `Mutex<()>`.
--> $DIR/mutex_atomic.rs:13:5 --> $DIR/mutex_atomic.rs:13:5
| |
LL | Mutex::new(0i32); LL | Mutex::new(0i32);

View File

@ -1,4 +1,4 @@
error: This else block is redundant. error: This `else` block is redundant.
--> $DIR/needless_continue.rs:28:16 --> $DIR/needless_continue.rs:28:16
| |
@ -9,7 +9,7 @@ LL | | }
| |_________^ | |_________^
| |
= note: `-D clippy::needless-continue` implied by `-D warnings` = note: `-D clippy::needless-continue` implied by `-D warnings`
= help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so: = help: Consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block, like so:
if i % 2 == 0 && i % 3 == 0 { if i % 2 == 0 && i % 3 == 0 {
println!("{}", i); println!("{}", i);
println!("{}", i + 1); println!("{}", i + 1);
@ -47,7 +47,7 @@ LL | | println!("Jabber");
LL | | } LL | | }
| |_________^ | |_________^
| |
= help: Consider dropping the else clause, and moving out the code in the else block, like so: = help: Consider dropping the `else` clause, and moving out the code in the `else` block, like so:
if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 { if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
continue; continue;
} }
@ -55,7 +55,7 @@ LL | | }
println!("Jabber"); println!("Jabber");
... ...
error: This else block is redundant. error: This `else` block is redundant.
--> $DIR/needless_continue.rs:100:24 --> $DIR/needless_continue.rs:100:24
| |
@ -65,7 +65,7 @@ LL | | continue 'inner; // should lint here
LL | | } LL | | }
| |_________________^ | |_________________^
| |
= help: Consider dropping the else clause and merging the code that follows (in the loop) with the if block, like so: = help: Consider dropping the `else` clause and merging the code that follows (in the loop) with the `if` block, like so:
if condition() { if condition() {
println!("bar-3"); println!("bar-3");
// Merged code follows...println!("bar-4"); // Merged code follows...println!("bar-4");
@ -90,7 +90,7 @@ LL | | println!("bar-5");
LL | | } LL | | }
| |_________________^ | |_________________^
| |
= help: Consider dropping the else clause, and moving out the code in the else block, like so: = help: Consider dropping the `else` clause, and moving out the code in the `else` block, like so:
if condition() { if condition() {
continue; continue;
} }

View File

@ -120,7 +120,7 @@ error: this argument is passed by value, but not consumed in the function body
LL | fn bar_copy(x: u32, y: CopyWrapper) { LL | fn bar_copy(x: u32, y: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as Copy help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:124:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
@ -132,7 +132,7 @@ error: this argument is passed by value, but not consumed in the function body
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as Copy help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:124:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
@ -144,7 +144,7 @@ error: this argument is passed by value, but not consumed in the function body
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as Copy help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:124:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);
@ -156,7 +156,7 @@ error: this argument is passed by value, but not consumed in the function body
LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) { LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
| ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper` | ^^^^^^^^^^^ help: consider taking a reference instead: `&CopyWrapper`
| |
help: consider marking this type as Copy help: consider marking this type as `Copy`
--> $DIR/needless_pass_by_value.rs:124:1 --> $DIR/needless_pass_by_value.rs:124:1
| |
LL | struct CopyWrapper(u32); LL | struct CopyWrapper(u32);

View File

@ -1,4 +1,4 @@
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:18:5 --> $DIR/needless_return.rs:18:5
| |
LL | return true; LL | return true;
@ -6,67 +6,67 @@ LL | return true;
| |
= note: `-D clippy::needless-return` implied by `-D warnings` = note: `-D clippy::needless-return` implied by `-D warnings`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:22:5 --> $DIR/needless_return.rs:22:5
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:27:9 --> $DIR/needless_return.rs:27:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:29:9 --> $DIR/needless_return.rs:29:9
| |
LL | return false; LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:35:17 --> $DIR/needless_return.rs:35:17
| |
LL | true => return false, LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false` | ^^^^^^^^^^^^ help: remove `return`: `false`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:37:13 --> $DIR/needless_return.rs:37:13
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:44:9 --> $DIR/needless_return.rs:44:9
| |
LL | return true; LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:46:16 --> $DIR/needless_return.rs:46:16
| |
LL | let _ = || return true; LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true` | ^^^^^^^^^^^ help: remove `return`: `true`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:54:5 --> $DIR/needless_return.rs:54:5
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:59:9 --> $DIR/needless_return.rs:59:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:61:9 --> $DIR/needless_return.rs:61:9
| |
LL | return; LL | return;
| ^^^^^^^ help: remove `return` | ^^^^^^^ help: remove `return`
error: unneeded return statement error: unneeded `return` statement
--> $DIR/needless_return.rs:68:14 --> $DIR/needless_return.rs:68:14
| |
LL | _ => return, LL | _ => return,

View File

@ -1,4 +1,4 @@
error: Negation by multiplying with -1 error: Negation by multiplying with `-1`
--> $DIR/neg_multiply.rs:27:5 --> $DIR/neg_multiply.rs:27:5
| |
LL | x * -1; LL | x * -1;
@ -6,7 +6,7 @@ LL | x * -1;
| |
= note: `-D clippy::neg-multiply` implied by `-D warnings` = note: `-D clippy::neg-multiply` implied by `-D warnings`
error: Negation by multiplying with -1 error: Negation by multiplying with `-1`
--> $DIR/neg_multiply.rs:29:5 --> $DIR/neg_multiply.rs:29:5
| |
LL | -1 * x; LL | -1 * x;

View File

@ -1,4 +1,4 @@
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:9:1 --> $DIR/non_copy_const.rs:9:1
| |
LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
@ -8,7 +8,7 @@ LL | const ATOMIC: AtomicUsize = AtomicUsize::new(5); //~ ERROR interior mutable
| |
= note: `#[deny(clippy::declare_interior_mutable_const)]` on by default = note: `#[deny(clippy::declare_interior_mutable_const)]` on by default
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:10:1 --> $DIR/non_copy_const.rs:10:1
| |
LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
@ -16,7 +16,7 @@ LL | const CELL: Cell<usize> = Cell::new(6); //~ ERROR interior mutable
| | | |
| make this a static item (maybe with lazy_static) | make this a static item (maybe with lazy_static)
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:11:1 --> $DIR/non_copy_const.rs:11:1
| |
LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7); LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], Vec::new(), 7);
@ -24,7 +24,7 @@ LL | const ATOMIC_TUPLE: ([AtomicUsize; 1], Vec<AtomicUsize>, u8) = ([ATOMIC], V
| | | |
| make this a static item (maybe with lazy_static) | make this a static item (maybe with lazy_static)
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:16:9 --> $DIR/non_copy_const.rs:16:9
| |
LL | const $name: $ty = $e; LL | const $name: $ty = $e;
@ -33,13 +33,13 @@ LL | const $name: $ty = $e;
LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable LL | declare_const!(_ONCE: Once = Once::new()); //~ ERROR interior mutable
| ------------------------------------------ in this macro invocation | ------------------------------------------ in this macro invocation
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:40:5 --> $DIR/non_copy_const.rs:40:5
| |
LL | const ATOMIC: AtomicUsize; //~ ERROR interior mutable LL | const ATOMIC: AtomicUsize; //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:44:5 --> $DIR/non_copy_const.rs:44:5
| |
LL | const INPUT: T; LL | const INPUT: T;
@ -47,7 +47,7 @@ LL | const INPUT: T;
| | | |
| consider requiring `T` to be `Copy` | consider requiring `T` to be `Copy`
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:47:5 --> $DIR/non_copy_const.rs:47:5
| |
LL | const ASSOC: Self::NonCopyType; LL | const ASSOC: Self::NonCopyType;
@ -55,7 +55,7 @@ LL | const ASSOC: Self::NonCopyType;
| | | |
| consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy` | consider requiring `<Self as Trait<T>>::NonCopyType` to be `Copy`
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:51:5 --> $DIR/non_copy_const.rs:51:5
| |
LL | const AN_INPUT: T = Self::INPUT; LL | const AN_INPUT: T = Self::INPUT;
@ -63,7 +63,7 @@ LL | const AN_INPUT: T = Self::INPUT;
| | | |
| consider requiring `T` to be `Copy` | consider requiring `T` to be `Copy`
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:16:9 --> $DIR/non_copy_const.rs:16:9
| |
LL | const $name: $ty = $e; LL | const $name: $ty = $e;
@ -72,7 +72,7 @@ LL | const $name: $ty = $e;
LL | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable LL | declare_const!(ANOTHER_INPUT: T = Self::INPUT); //~ ERROR interior mutable
| ----------------------------------------------- in this macro invocation | ----------------------------------------------- in this macro invocation
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:60:5 --> $DIR/non_copy_const.rs:60:5
| |
LL | const SELF_2: Self; LL | const SELF_2: Self;
@ -80,13 +80,13 @@ LL | const SELF_2: Self;
| | | |
| consider requiring `Self` to be `Copy` | consider requiring `Self` to be `Copy`
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:81:5 --> $DIR/non_copy_const.rs:81:5
| |
LL | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable LL | const ASSOC_3: AtomicUsize = AtomicUsize::new(14); //~ ERROR interior mutable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:84:5 --> $DIR/non_copy_const.rs:84:5
| |
LL | const U_SELF: U = U::SELF_2; LL | const U_SELF: U = U::SELF_2;
@ -94,7 +94,7 @@ LL | const U_SELF: U = U::SELF_2;
| | | |
| consider requiring `U` to be `Copy` | consider requiring `U` to be `Copy`
error: a const item should never be interior mutable error: a `const` item should never be interior mutable
--> $DIR/non_copy_const.rs:87:5 --> $DIR/non_copy_const.rs:87:5
| |
LL | const T_ASSOC: T::NonCopyType = T::ASSOC; LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
@ -102,7 +102,7 @@ LL | const T_ASSOC: T::NonCopyType = T::ASSOC;
| | | |
| consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy` | consider requiring `<T as Trait<u32>>::NonCopyType` to be `Copy`
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:94:5 --> $DIR/non_copy_const.rs:94:5
| |
LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
@ -111,7 +111,7 @@ LL | ATOMIC.store(1, Ordering::SeqCst); //~ ERROR interior mutability
= note: `#[deny(clippy::borrow_interior_mutable_const)]` on by default = note: `#[deny(clippy::borrow_interior_mutable_const)]` on by default
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:95:16 --> $DIR/non_copy_const.rs:95:16
| |
LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutability
@ -119,7 +119,7 @@ LL | assert_eq!(ATOMIC.load(Ordering::SeqCst), 5); //~ ERROR interior mutabi
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:98:22 --> $DIR/non_copy_const.rs:98:22
| |
LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
@ -127,7 +127,7 @@ LL | let _once_ref = &ONCE_INIT; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:99:25 --> $DIR/non_copy_const.rs:99:25
| |
LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
@ -135,7 +135,7 @@ LL | let _once_ref_2 = &&ONCE_INIT; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:100:27 --> $DIR/non_copy_const.rs:100:27
| |
LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
@ -143,7 +143,7 @@ LL | let _once_ref_4 = &&&&ONCE_INIT; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:101:26 --> $DIR/non_copy_const.rs:101:26
| |
LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
@ -151,7 +151,7 @@ LL | let _once_mut = &mut ONCE_INIT; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:112:14 --> $DIR/non_copy_const.rs:112:14
| |
LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
@ -159,7 +159,7 @@ LL | let _ = &ATOMIC_TUPLE; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:113:14 --> $DIR/non_copy_const.rs:113:14
| |
LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
@ -167,7 +167,7 @@ LL | let _ = &ATOMIC_TUPLE.0; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:114:19 --> $DIR/non_copy_const.rs:114:19
| |
LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
@ -175,7 +175,7 @@ LL | let _ = &(&&&&ATOMIC_TUPLE).0; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:115:14 --> $DIR/non_copy_const.rs:115:14
| |
LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
@ -183,7 +183,7 @@ LL | let _ = &ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:116:13 --> $DIR/non_copy_const.rs:116:13
| |
LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mutability
@ -191,7 +191,7 @@ LL | let _ = ATOMIC_TUPLE.0[0].load(Ordering::SeqCst); //~ ERROR interior mu
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:122:13 --> $DIR/non_copy_const.rs:122:13
| |
LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
@ -199,7 +199,7 @@ LL | let _ = ATOMIC_TUPLE.0[0]; //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:127:5 --> $DIR/non_copy_const.rs:127:5
| |
LL | CELL.set(2); //~ ERROR interior mutability LL | CELL.set(2); //~ ERROR interior mutability
@ -207,7 +207,7 @@ LL | CELL.set(2); //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:128:16 --> $DIR/non_copy_const.rs:128:16
| |
LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
@ -215,7 +215,7 @@ LL | assert_eq!(CELL.get(), 6); //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:141:5 --> $DIR/non_copy_const.rs:141:5
| |
LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
@ -223,7 +223,7 @@ LL | u64::ATOMIC.store(5, Ordering::SeqCst); //~ ERROR interior mutability
| |
= help: assign this const to a local or static variable, and use the variable here = help: assign this const to a local or static variable, and use the variable here
error: a const item with interior mutability should not be borrowed error: a `const` item with interior mutability should not be borrowed
--> $DIR/non_copy_const.rs:142:16 --> $DIR/non_copy_const.rs:142:16
| |
LL | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability LL | assert_eq!(u64::ATOMIC.load(Ordering::SeqCst), 9); //~ ERROR interior mutability

View File

@ -1,4 +1,4 @@
error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
--> $DIR/ok_expect.rs:14:5 --> $DIR/ok_expect.rs:14:5
| |
LL | res.ok().expect("disaster!"); LL | res.ok().expect("disaster!");
@ -6,25 +6,25 @@ LL | res.ok().expect("disaster!");
| |
= note: `-D clippy::ok-expect` implied by `-D warnings` = note: `-D clippy::ok-expect` implied by `-D warnings`
error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
--> $DIR/ok_expect.rs:20:5 --> $DIR/ok_expect.rs:20:5
| |
LL | res3.ok().expect("whoof"); LL | res3.ok().expect("whoof");
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
--> $DIR/ok_expect.rs:22:5 --> $DIR/ok_expect.rs:22:5
| |
LL | res4.ok().expect("argh"); LL | res4.ok().expect("argh");
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
--> $DIR/ok_expect.rs:24:5 --> $DIR/ok_expect.rs:24:5
| |
LL | res5.ok().expect("oops"); LL | res5.ok().expect("oops");
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: called `ok().expect()` on a Result value. You can call `expect` directly on the `Result` error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
--> $DIR/ok_expect.rs:26:5 --> $DIR/ok_expect.rs:26:5
| |
LL | res6.ok().expect("meh"); LL | res6.ok().expect("meh");

View File

@ -1,4 +1,4 @@
error: file opened with "truncate" and "read" error: file opened with `truncate` and `read`
--> $DIR/open_options.rs:6:5 --> $DIR/open_options.rs:6:5
| |
LL | OpenOptions::new().read(true).truncate(true).open("foo.txt"); LL | OpenOptions::new().read(true).truncate(true).open("foo.txt");
@ -6,37 +6,37 @@ LL | OpenOptions::new().read(true).truncate(true).open("foo.txt");
| |
= note: `-D clippy::nonsensical-open-options` implied by `-D warnings` = note: `-D clippy::nonsensical-open-options` implied by `-D warnings`
error: file opened with "append" and "truncate" error: file opened with `append` and `truncate`
--> $DIR/open_options.rs:7:5 --> $DIR/open_options.rs:7:5
| |
LL | OpenOptions::new().append(true).truncate(true).open("foo.txt"); LL | OpenOptions::new().append(true).truncate(true).open("foo.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the method "read" is called more than once error: the method `read` is called more than once
--> $DIR/open_options.rs:9:5 --> $DIR/open_options.rs:9:5
| |
LL | OpenOptions::new().read(true).read(false).open("foo.txt"); LL | OpenOptions::new().read(true).read(false).open("foo.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the method "create" is called more than once error: the method `create` is called more than once
--> $DIR/open_options.rs:10:5 --> $DIR/open_options.rs:10:5
| |
LL | OpenOptions::new().create(true).create(false).open("foo.txt"); LL | OpenOptions::new().create(true).create(false).open("foo.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the method "write" is called more than once error: the method `write` is called more than once
--> $DIR/open_options.rs:11:5 --> $DIR/open_options.rs:11:5
| |
LL | OpenOptions::new().write(true).write(false).open("foo.txt"); LL | OpenOptions::new().write(true).write(false).open("foo.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the method "append" is called more than once error: the method `append` is called more than once
--> $DIR/open_options.rs:12:5 --> $DIR/open_options.rs:12:5
| |
LL | OpenOptions::new().append(true).append(false).open("foo.txt"); LL | OpenOptions::new().append(true).append(false).open("foo.txt");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the method "truncate" is called more than once error: the method `truncate` is called more than once
--> $DIR/open_options.rs:13:5 --> $DIR/open_options.rs:13:5
| |
LL | OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); LL | OpenOptions::new().truncate(true).truncate(false).open("foo.txt");

View File

@ -1,12 +1,12 @@
error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead error: called `map_or(None, f)` on an `Option` value. This can be done more directly by calling `and_then(f)` instead
--> $DIR/option_map_or_none.rs:10:13 --> $DIR/option_map_or_none.rs:10:13
| |
LL | let _ = opt.map_or(None, |x| Some(x + 1)); LL | let _ = opt.map_or(None, |x| Some(x + 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `and_then` instead: `opt.and_then(|x| Some(x + 1))`
| |
= note: `-D clippy::option-map-or-none` implied by `-D warnings` = note: `-D clippy::option-map-or-none` implied by `-D warnings`
error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead error: called `map_or(None, f)` on an `Option` value. This can be done more directly by calling `and_then(f)` instead
--> $DIR/option_map_or_none.rs:13:13 --> $DIR/option_map_or_none.rs:13:13
| |
LL | let _ = opt.map_or(None, |x| { LL | let _ = opt.map_or(None, |x| {
@ -15,7 +15,7 @@ LL | | Some(x + 1)
LL | | }); LL | | });
| |_________________________^ | |_________________________^
| |
help: try using and_then instead help: try using `and_then` instead
| |
LL | let _ = opt.and_then(|x| { LL | let _ = opt.and_then(|x| {
LL | Some(x + 1) LL | Some(x + 1)

View File

@ -1,4 +1,4 @@
error: called `map(f)` on an Option value where `f` is a unit function error: called `map(f)` on an `Option` value where `f` is a unit function
--> $DIR/option_map_unit_fn_fixable.rs:34:5 --> $DIR/option_map_unit_fn_fixable.rs:34:5
| |
LL | x.field.map(do_nothing); LL | x.field.map(do_nothing);
@ -8,7 +8,7 @@ LL | x.field.map(do_nothing);
| |
= note: `-D clippy::option-map-unit-fn` implied by `-D warnings` = note: `-D clippy::option-map-unit-fn` implied by `-D warnings`
error: called `map(f)` on an Option value where `f` is a unit function error: called `map(f)` on an `Option` value where `f` is a unit function
--> $DIR/option_map_unit_fn_fixable.rs:36:5 --> $DIR/option_map_unit_fn_fixable.rs:36:5
| |
LL | x.field.map(do_nothing); LL | x.field.map(do_nothing);
@ -16,7 +16,7 @@ LL | x.field.map(do_nothing);
| | | |
| help: try this: `if let Some(x_field) = x.field { do_nothing(x_field) }` | help: try this: `if let Some(x_field) = x.field { do_nothing(x_field) }`
error: called `map(f)` on an Option value where `f` is a unit function error: called `map(f)` on an `Option` value where `f` is a unit function
--> $DIR/option_map_unit_fn_fixable.rs:38:5 --> $DIR/option_map_unit_fn_fixable.rs:38:5
| |
LL | x.field.map(diverge); LL | x.field.map(diverge);
@ -24,7 +24,7 @@ LL | x.field.map(diverge);
| | | |
| help: try this: `if let Some(x_field) = x.field { diverge(x_field) }` | help: try this: `if let Some(x_field) = x.field { diverge(x_field) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:44:5 --> $DIR/option_map_unit_fn_fixable.rs:44:5
| |
LL | x.field.map(|value| x.do_option_nothing(value + captured)); LL | x.field.map(|value| x.do_option_nothing(value + captured));
@ -32,7 +32,7 @@ LL | x.field.map(|value| x.do_option_nothing(value + captured));
| | | |
| help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }` | help: try this: `if let Some(value) = x.field { x.do_option_nothing(value + captured) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:46:5 --> $DIR/option_map_unit_fn_fixable.rs:46:5
| |
LL | x.field.map(|value| { x.do_option_plus_one(value + captured); }); LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
@ -40,7 +40,7 @@ LL | x.field.map(|value| { x.do_option_plus_one(value + captured); });
| | | |
| help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }` | help: try this: `if let Some(value) = x.field { x.do_option_plus_one(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:49:5 --> $DIR/option_map_unit_fn_fixable.rs:49:5
| |
LL | x.field.map(|value| do_nothing(value + captured)); LL | x.field.map(|value| do_nothing(value + captured));
@ -48,7 +48,7 @@ LL | x.field.map(|value| do_nothing(value + captured));
| | | |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:51:5 --> $DIR/option_map_unit_fn_fixable.rs:51:5
| |
LL | x.field.map(|value| { do_nothing(value + captured) }); LL | x.field.map(|value| { do_nothing(value + captured) });
@ -56,7 +56,7 @@ LL | x.field.map(|value| { do_nothing(value + captured) });
| | | |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }` | help: try this: `if let Some(value) = x.field { do_nothing(value + captured) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:53:5 --> $DIR/option_map_unit_fn_fixable.rs:53:5
| |
LL | x.field.map(|value| { do_nothing(value + captured); }); LL | x.field.map(|value| { do_nothing(value + captured); });
@ -64,7 +64,7 @@ LL | x.field.map(|value| { do_nothing(value + captured); });
| | | |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:55:5 --> $DIR/option_map_unit_fn_fixable.rs:55:5
| |
LL | x.field.map(|value| { { do_nothing(value + captured); } }); LL | x.field.map(|value| { { do_nothing(value + captured); } });
@ -72,7 +72,7 @@ LL | x.field.map(|value| { { do_nothing(value + captured); } });
| | | |
| help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }` | help: try this: `if let Some(value) = x.field { do_nothing(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:58:5 --> $DIR/option_map_unit_fn_fixable.rs:58:5
| |
LL | x.field.map(|value| diverge(value + captured)); LL | x.field.map(|value| diverge(value + captured));
@ -80,7 +80,7 @@ LL | x.field.map(|value| diverge(value + captured));
| | | |
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }` | help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:60:5 --> $DIR/option_map_unit_fn_fixable.rs:60:5
| |
LL | x.field.map(|value| { diverge(value + captured) }); LL | x.field.map(|value| { diverge(value + captured) });
@ -88,7 +88,7 @@ LL | x.field.map(|value| { diverge(value + captured) });
| | | |
| help: try this: `if let Some(value) = x.field { diverge(value + captured) }` | help: try this: `if let Some(value) = x.field { diverge(value + captured) }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:62:5 --> $DIR/option_map_unit_fn_fixable.rs:62:5
| |
LL | x.field.map(|value| { diverge(value + captured); }); LL | x.field.map(|value| { diverge(value + captured); });
@ -96,7 +96,7 @@ LL | x.field.map(|value| { diverge(value + captured); });
| | | |
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }` | help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:64:5 --> $DIR/option_map_unit_fn_fixable.rs:64:5
| |
LL | x.field.map(|value| { { diverge(value + captured); } }); LL | x.field.map(|value| { { diverge(value + captured); } });
@ -104,7 +104,7 @@ LL | x.field.map(|value| { { diverge(value + captured); } });
| | | |
| help: try this: `if let Some(value) = x.field { diverge(value + captured); }` | help: try this: `if let Some(value) = x.field { diverge(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:69:5 --> $DIR/option_map_unit_fn_fixable.rs:69:5
| |
LL | x.field.map(|value| { let y = plus_one(value + captured); }); LL | x.field.map(|value| { let y = plus_one(value + captured); });
@ -112,7 +112,7 @@ LL | x.field.map(|value| { let y = plus_one(value + captured); });
| | | |
| help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }` | help: try this: `if let Some(value) = x.field { let y = plus_one(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:71:5 --> $DIR/option_map_unit_fn_fixable.rs:71:5
| |
LL | x.field.map(|value| { plus_one(value + captured); }); LL | x.field.map(|value| { plus_one(value + captured); });
@ -120,7 +120,7 @@ LL | x.field.map(|value| { plus_one(value + captured); });
| | | |
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:73:5 --> $DIR/option_map_unit_fn_fixable.rs:73:5
| |
LL | x.field.map(|value| { { plus_one(value + captured); } }); LL | x.field.map(|value| { { plus_one(value + captured); } });
@ -128,7 +128,7 @@ LL | x.field.map(|value| { { plus_one(value + captured); } });
| | | |
| help: try this: `if let Some(value) = x.field { plus_one(value + captured); }` | help: try this: `if let Some(value) = x.field { plus_one(value + captured); }`
error: called `map(f)` on an Option value where `f` is a unit closure error: called `map(f)` on an `Option` value where `f` is a unit closure
--> $DIR/option_map_unit_fn_fixable.rs:76:5 --> $DIR/option_map_unit_fn_fixable.rs:76:5
| |
LL | x.field.map(|ref value| { do_nothing(value + captured) });} LL | x.field.map(|ref value| { do_nothing(value + captured) });}

Some files were not shown because too many files have changed in this diff Show More