1
Fork 0

Fix clippy with changed macro statement spans

This commit is contained in:
Cameron Steffen 2021-10-14 13:28:30 -05:00
parent 049ab82662
commit 0a23fff82d
30 changed files with 126 additions and 130 deletions

View file

@ -9,7 +9,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::{Block, Expr, ExprKind, HirId}; use rustc_hir::{Block, Expr, ExprKind, HirId};
use rustc_lint::{LateContext, LateLintPass}; use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::hir::map::Map; use rustc_middle::hir::map::Map;
use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::{source_map::Span, symbol::Symbol, BytePos}; use rustc_span::{source_map::Span, symbol::Symbol, BytePos};
@ -432,10 +432,11 @@ fn emit_branches_sharing_code_lint(
let mut add_expr_note = false; let mut add_expr_note = false;
// Construct suggestions // Construct suggestions
let sm = cx.sess().source_map();
if start_stmts > 0 { if start_stmts > 0 {
let block = blocks[0]; let block = blocks[0];
let span_start = first_line_of_span(cx, if_expr.span).shrink_to_lo(); let span_start = first_line_of_span(cx, if_expr.span).shrink_to_lo();
let span_end = block.stmts[start_stmts - 1].span.source_callsite(); let span_end = sm.stmt_span(block.stmts[start_stmts - 1].span, block.span);
let cond_span = first_line_of_span(cx, if_expr.span).until(block.span); let cond_span = first_line_of_span(cx, if_expr.span).until(block.span);
let cond_snippet = reindent_multiline(snippet(cx, cond_span, "_"), false, None); let cond_snippet = reindent_multiline(snippet(cx, cond_span, "_"), false, None);
@ -454,15 +455,16 @@ fn emit_branches_sharing_code_lint(
let span_end = block.span.shrink_to_hi(); let span_end = block.span.shrink_to_hi();
let moved_start = if end_stmts == 0 && block.expr.is_some() { let moved_start = if end_stmts == 0 && block.expr.is_some() {
block.expr.unwrap().span block.expr.unwrap().span.source_callsite()
} else { } else {
block.stmts[block.stmts.len() - end_stmts].span sm.stmt_span(block.stmts[block.stmts.len() - end_stmts].span, block.span)
} };
.source_callsite();
let moved_end = block let moved_end = block
.expr .expr
.map_or_else(|| block.stmts[block.stmts.len() - 1].span, |expr| expr.span) .map_or_else(
.source_callsite(); || sm.stmt_span(block.stmts[block.stmts.len() - 1].span, block.span),
|expr| expr.span.source_callsite(),
);
let moved_span = moved_start.to(moved_end); let moved_span = moved_start.to(moved_end);
let moved_snipped = reindent_multiline(snippet(cx, moved_span, "_"), true, None); let moved_snipped = reindent_multiline(snippet(cx, moved_span, "_"), true, None);

View file

@ -90,12 +90,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessFormat {
} }
} }
fn span_useless_format(cx: &LateContext<'_>, span: Span, mut sugg: String, mut applicability: Applicability) { fn span_useless_format(cx: &LateContext<'_>, span: Span, sugg: String, applicability: Applicability) {
// The callsite span contains the statement semicolon for some reason.
if snippet_with_applicability(cx, span, "..", &mut applicability).ends_with(';') {
sugg.push(';');
}
span_lint_and_sugg( span_lint_and_sugg(
cx, cx,
USELESS_FORMAT, USELESS_FORMAT,

View file

@ -36,9 +36,8 @@
use clippy_utils::diagnostics::span_lint_and_help; use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::source::{indent_of, snippet, snippet_block}; use clippy_utils::source::{indent_of, snippet, snippet_block};
use rustc_ast::ast; use rustc_ast::ast;
use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{original_sp, DUMMY_SP};
use rustc_span::Span; use rustc_span::Span;
declare_clippy_lint! { declare_clippy_lint! {
@ -270,7 +269,7 @@ struct LintData<'a> {
/// The 0-based index of the `if` statement in the containing loop block. /// The 0-based index of the `if` statement in the containing loop block.
stmt_idx: usize, stmt_idx: usize,
/// The statements of the loop block. /// The statements of the loop block.
block_stmts: &'a [ast::Stmt], loop_block: &'a ast::Block,
} }
const MSG_REDUNDANT_CONTINUE_EXPRESSION: &str = "this `continue` expression is redundant"; const MSG_REDUNDANT_CONTINUE_EXPRESSION: &str = "this `continue` expression is redundant";
@ -343,10 +342,10 @@ fn suggestion_snippet_for_continue_inside_else<'a>(cx: &EarlyContext<'_>, data:
let indent = span_of_first_expr_in_block(data.if_block) let indent = span_of_first_expr_in_block(data.if_block)
.and_then(|span| indent_of(cx, span)) .and_then(|span| indent_of(cx, span))
.unwrap_or(0); .unwrap_or(0);
let to_annex = data.block_stmts[data.stmt_idx + 1..] let to_annex = data.loop_block.stmts[data.stmt_idx + 1..]
.iter() .iter()
.map(|stmt| original_sp(stmt.span, DUMMY_SP)) .map(|stmt| {
.map(|span| { let span = cx.sess().source_map().stmt_span(stmt.span, data.loop_block.span);
let snip = snippet_block(cx, span, "..", None).into_owned(); let snip = snippet_block(cx, span, "..", None).into_owned();
snip.lines() snip.lines()
.map(|line| format!("{}{}", " ".repeat(indent), line)) .map(|line| format!("{}{}", " ".repeat(indent), line))
@ -393,7 +392,7 @@ fn check_and_warn<'a>(cx: &EarlyContext<'_>, expr: &'a ast::Expr) {
if_cond: cond, if_cond: cond,
if_block: then_block, if_block: then_block,
else_expr, else_expr,
block_stmts: &loop_block.stmts, loop_block,
}; };
if needless_continue_in_else(else_expr, label) { if needless_continue_in_else(else_expr, label) {
emit_warning( emit_warning(

View file

@ -82,13 +82,13 @@ error: use of irregular braces for `eprint!` macro
--> $DIR/conf_nonstandard_macro_braces.rs:57:5 --> $DIR/conf_nonstandard_macro_braces.rs:57:5
| |
LL | eprint!("test if user config overrides defaults"); LL | eprint!("test if user config overrides defaults");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
help: consider writing `eprint!["test if user config overrides defaults"];` help: consider writing `eprint!["test if user config overrides defaults"]`
--> $DIR/conf_nonstandard_macro_braces.rs:57:5 --> $DIR/conf_nonstandard_macro_braces.rs:57:5
| |
LL | eprint!("test if user config overrides defaults"); LL | eprint!("test if user config overrides defaults");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -2,7 +2,7 @@ error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:9:9 --> $DIR/asm_syntax.rs:9:9
| |
LL | asm!(""); LL | asm!("");
| ^^^^^^^^^ | ^^^^^^^^
| |
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings` = note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings`
= help: use AT&T x86 assembly syntax = help: use AT&T x86 assembly syntax
@ -11,7 +11,7 @@ error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:10:9 --> $DIR/asm_syntax.rs:10:9
| |
LL | asm!("", options()); LL | asm!("", options());
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= help: use AT&T x86 assembly syntax = help: use AT&T x86 assembly syntax
@ -19,7 +19,7 @@ error: Intel x86 assembly syntax used
--> $DIR/asm_syntax.rs:11:9 --> $DIR/asm_syntax.rs:11:9
| |
LL | asm!("", options(nostack)); LL | asm!("", options(nostack));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: use AT&T x86 assembly syntax = help: use AT&T x86 assembly syntax
@ -27,7 +27,7 @@ error: AT&T x86 assembly syntax used
--> $DIR/asm_syntax.rs:23:9 --> $DIR/asm_syntax.rs:23:9
| |
LL | asm!("", options(att_syntax)); LL | asm!("", options(att_syntax));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings` = note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings`
= help: use Intel x86 assembly syntax = help: use Intel x86 assembly syntax
@ -36,7 +36,7 @@ error: AT&T x86 assembly syntax used
--> $DIR/asm_syntax.rs:24:9 --> $DIR/asm_syntax.rs:24:9
| |
LL | asm!("", options(nostack, att_syntax)); LL | asm!("", options(nostack, att_syntax));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: use Intel x86 assembly syntax = help: use Intel x86 assembly syntax

View file

@ -2,7 +2,7 @@ error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:11:5 --> $DIR/assertions_on_constants.rs:11:5
| |
LL | assert!(true); LL | assert!(true);
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= note: `-D clippy::assertions-on-constants` implied by `-D warnings` = note: `-D clippy::assertions-on-constants` implied by `-D warnings`
= help: remove it = help: remove it
@ -12,7 +12,7 @@ error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:12:5 --> $DIR/assertions_on_constants.rs:12:5
| |
LL | assert!(false); LL | assert!(false);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= help: use `panic!()` or `unreachable!()` = help: use `panic!()` or `unreachable!()`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -21,7 +21,7 @@ error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:13:5 --> $DIR/assertions_on_constants.rs:13:5
| |
LL | assert!(true, "true message"); LL | assert!(true, "true message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: remove it = help: remove it
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -30,7 +30,7 @@ error: `assert!(false, "false message")` should probably be replaced
--> $DIR/assertions_on_constants.rs:14:5 --> $DIR/assertions_on_constants.rs:14:5
| |
LL | assert!(false, "false message"); LL | assert!(false, "false message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: use `panic!("false message")` or `unreachable!("false message")` = help: use `panic!("false message")` or `unreachable!("false message")`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -39,7 +39,7 @@ error: `assert!(false, msg.to_uppercase())` should probably be replaced
--> $DIR/assertions_on_constants.rs:17:5 --> $DIR/assertions_on_constants.rs:17:5
| |
LL | assert!(false, msg.to_uppercase()); LL | assert!(false, msg.to_uppercase());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: use `panic!(msg.to_uppercase())` or `unreachable!(msg.to_uppercase())` = help: use `panic!(msg.to_uppercase())` or `unreachable!(msg.to_uppercase())`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -48,7 +48,7 @@ error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:20:5 --> $DIR/assertions_on_constants.rs:20:5
| |
LL | assert!(B); LL | assert!(B);
| ^^^^^^^^^^^ | ^^^^^^^^^^
| |
= help: remove it = help: remove it
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -57,7 +57,7 @@ error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:23:5 --> $DIR/assertions_on_constants.rs:23:5
| |
LL | assert!(C); LL | assert!(C);
| ^^^^^^^^^^^ | ^^^^^^^^^^
| |
= help: use `panic!()` or `unreachable!()` = help: use `panic!()` or `unreachable!()`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -66,7 +66,7 @@ error: `assert!(false, "C message")` should probably be replaced
--> $DIR/assertions_on_constants.rs:24:5 --> $DIR/assertions_on_constants.rs:24:5
| |
LL | assert!(C, "C message"); LL | assert!(C, "C message");
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: use `panic!("C message")` or `unreachable!("C message")` = help: use `panic!("C message")` or `unreachable!("C message")`
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -75,7 +75,7 @@ error: `debug_assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:26:5 --> $DIR/assertions_on_constants.rs:26:5
| |
LL | debug_assert!(true); LL | debug_assert!(true);
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
| |
= help: remove it = help: remove it
= note: this error originates in the macro `$crate::assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::assert` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -2,7 +2,7 @@ error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:69:5 --> $DIR/bool_assert_comparison.rs:69:5
| |
LL | assert_eq!("a".is_empty(), false); LL | assert_eq!("a".is_empty(), false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
| |
= note: `-D clippy::bool-assert-comparison` implied by `-D warnings` = note: `-D clippy::bool-assert-comparison` implied by `-D warnings`
@ -10,127 +10,127 @@ error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:70:5 --> $DIR/bool_assert_comparison.rs:70:5
| |
LL | assert_eq!("".is_empty(), true); LL | assert_eq!("".is_empty(), true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_eq!` with a literal bool error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:71:5 --> $DIR/bool_assert_comparison.rs:71:5
| |
LL | assert_eq!(true, "".is_empty()); LL | assert_eq!(true, "".is_empty());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_eq!` with a literal bool error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:76:5 --> $DIR/bool_assert_comparison.rs:76:5
| |
LL | assert_eq!(b, true); LL | assert_eq!(b, true);
| ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_ne!` with a literal bool error: used `assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:79:5 --> $DIR/bool_assert_comparison.rs:79:5
| |
LL | assert_ne!("a".is_empty(), false); LL | assert_ne!("a".is_empty(), false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_ne!` with a literal bool error: used `assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:80:5 --> $DIR/bool_assert_comparison.rs:80:5
| |
LL | assert_ne!("".is_empty(), true); LL | assert_ne!("".is_empty(), true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_ne!` with a literal bool error: used `assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:81:5 --> $DIR/bool_assert_comparison.rs:81:5
| |
LL | assert_ne!(true, "".is_empty()); LL | assert_ne!(true, "".is_empty());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_ne!` with a literal bool error: used `assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:86:5 --> $DIR/bool_assert_comparison.rs:86:5
| |
LL | assert_ne!(b, true); LL | assert_ne!(b, true);
| ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:89:5 --> $DIR/bool_assert_comparison.rs:89:5
| |
LL | debug_assert_eq!("a".is_empty(), false); LL | debug_assert_eq!("a".is_empty(), false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:90:5 --> $DIR/bool_assert_comparison.rs:90:5
| |
LL | debug_assert_eq!("".is_empty(), true); LL | debug_assert_eq!("".is_empty(), true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:91:5 --> $DIR/bool_assert_comparison.rs:91:5
| |
LL | debug_assert_eq!(true, "".is_empty()); LL | debug_assert_eq!(true, "".is_empty());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:96:5 --> $DIR/bool_assert_comparison.rs:96:5
| |
LL | debug_assert_eq!(b, true); LL | debug_assert_eq!(b, true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_ne!` with a literal bool error: used `debug_assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:99:5 --> $DIR/bool_assert_comparison.rs:99:5
| |
LL | debug_assert_ne!("a".is_empty(), false); LL | debug_assert_ne!("a".is_empty(), false);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_ne!` with a literal bool error: used `debug_assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:100:5 --> $DIR/bool_assert_comparison.rs:100:5
| |
LL | debug_assert_ne!("".is_empty(), true); LL | debug_assert_ne!("".is_empty(), true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_ne!` with a literal bool error: used `debug_assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:101:5 --> $DIR/bool_assert_comparison.rs:101:5
| |
LL | debug_assert_ne!(true, "".is_empty()); LL | debug_assert_ne!(true, "".is_empty());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_ne!` with a literal bool error: used `debug_assert_ne!` with a literal bool
--> $DIR/bool_assert_comparison.rs:106:5 --> $DIR/bool_assert_comparison.rs:106:5
| |
LL | debug_assert_ne!(b, true); LL | debug_assert_ne!(b, true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `assert_eq!` with a literal bool error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:111:5 --> $DIR/bool_assert_comparison.rs:111:5
| |
LL | assert_eq!("a".is_empty(), false, "tadam {}", 1); LL | assert_eq!("a".is_empty(), false, "tadam {}", 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_eq!` with a literal bool error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:112:5 --> $DIR/bool_assert_comparison.rs:112:5
| |
LL | assert_eq!("a".is_empty(), false, "tadam {}", true); LL | assert_eq!("a".is_empty(), false, "tadam {}", true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `assert_eq!` with a literal bool error: used `assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:113:5 --> $DIR/bool_assert_comparison.rs:113:5
| |
LL | assert_eq!(false, "a".is_empty(), "tadam {}", true); LL | assert_eq!(false, "a".is_empty(), "tadam {}", true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:118:5 --> $DIR/bool_assert_comparison.rs:118:5
| |
LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", 1); LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:119:5 --> $DIR/bool_assert_comparison.rs:119:5
| |
LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", true); LL | debug_assert_eq!("a".is_empty(), false, "tadam {}", true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: used `debug_assert_eq!` with a literal bool error: used `debug_assert_eq!` with a literal bool
--> $DIR/bool_assert_comparison.rs:120:5 --> $DIR/bool_assert_comparison.rs:120:5
| |
LL | debug_assert_eq!(false, "a".is_empty(), "tadam {}", true); LL | debug_assert_eq!(false, "a".is_empty(), "tadam {}", true);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `debug_assert!(..)`
error: aborting due to 22 previous errors error: aborting due to 22 previous errors

View file

@ -71,7 +71,7 @@ LL | $a.unwrap(); // unnecessary
| ^^^^^^^^^^^ | ^^^^^^^^^^^
... ...
LL | m!(x); LL | m!(x);
| ------ in this macro invocation | ----- in this macro invocation
| |
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -46,7 +46,7 @@ LL | | },
| |_____________________^ | |_____________________^
... ...
LL | mac!(res_opt => Ok(val), val => Some(n), foo(n)); LL | mac!(res_opt => Ok(val), val => Some(n), foo(n));
| ------------------------------------------------- in this macro invocation | ------------------------------------------------ in this macro invocation
| |
help: the outer pattern can be modified to include the inner pattern help: the outer pattern can be modified to include the inner pattern
--> $DIR/collapsible_match2.rs:46:28 --> $DIR/collapsible_match2.rs:46:28

View file

@ -5,7 +5,7 @@ LL | extern crate std as core;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
... ...
LL | define_other_core!(); LL | define_other_core!();
| --------------------- in this macro invocation | -------------------- in this macro invocation
| |
= note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `define_other_core` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -31,7 +31,7 @@ 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
| |
= note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -13,7 +13,7 @@ LL | const $name: $ty = $e;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
... ...
LL | declare_const!(ANOTHER_ATOMIC: AtomicUsize = Self::ATOMIC); //~ ERROR interior mutable LL | declare_const!(ANOTHER_ATOMIC: AtomicUsize = Self::ATOMIC); //~ ERROR interior mutable
| ----------------------------------------------------------- in this macro invocation | ---------------------------------------------------------- in this macro invocation
| |
= note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `declare_const` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -139,7 +139,7 @@ LL | let x = 22.;
| ^^^ help: consider adding suffix: `22.0_f64` | ^^^ help: consider adding suffix: `22.0_f64`
... ...
LL | internal_macro!(); LL | internal_macro!();
| ------------------ in this macro invocation | ----------------- in this macro invocation
| |
= note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -151,7 +151,7 @@ LL | let x = 22;
| ^^ help: consider adding suffix: `22_i32` | ^^ help: consider adding suffix: `22_i32`
... ...
LL | internal_macro!(); LL | internal_macro!();
| ------------------ in this macro invocation | ----------------- in this macro invocation
| |
= note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `internal_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -47,7 +47,7 @@ LL | | }
| |_________^ | |_________^
... ...
LL | very_unsafe!(); LL | very_unsafe!();
| --------------- in this macro invocation | -------------- in this macro invocation
| |
= note: this error originates in the macro `very_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `very_unsafe` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -5,7 +5,7 @@ LL | assert_eq!(a, a);
| ^^^^ | ^^^^
... ...
LL | assert_in_macro_def!(); LL | assert_in_macro_def!();
| ----------------------- in this macro invocation | ---------------------- in this macro invocation
| |
= note: `-D clippy::eq-op` implied by `-D warnings` = note: `-D clippy::eq-op` implied by `-D warnings`
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -17,7 +17,7 @@ LL | assert_ne!(a, a);
| ^^^^ | ^^^^
... ...
LL | assert_in_macro_def!(); LL | assert_in_macro_def!();
| ----------------------- in this macro invocation | ---------------------- in this macro invocation
| |
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -52,7 +52,7 @@ LL | debug_assert_eq!(a, a);
| ^^^^ | ^^^^
... ...
LL | assert_in_macro_def!(); LL | assert_in_macro_def!();
| ----------------------- in this macro invocation | ---------------------- in this macro invocation
| |
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -63,7 +63,7 @@ LL | debug_assert_ne!(a, a);
| ^^^^ | ^^^^
... ...
LL | assert_in_macro_def!(); LL | assert_in_macro_def!();
| ----------------------- in this macro invocation | ---------------------- in this macro invocation
| |
= note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_in_macro_def` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -37,7 +37,7 @@ note: potential failure(s)
--> $DIR/fallible_impl_from.rs:30:13 --> $DIR/fallible_impl_from.rs:30:13
| |
LL | panic!(); LL | panic!();
| ^^^^^^^^^ | ^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead error: consider implementing `TryFrom` instead
@ -60,11 +60,11 @@ LL | let s = s.unwrap();
| ^^^^^^^^^^ | ^^^^^^^^^^
LL | if !s.is_empty() { LL | if !s.is_empty() {
LL | panic!("42"); LL | panic!("42");
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^
LL | } else if s.parse::<u32>().unwrap() != 42 { LL | } else if s.parse::<u32>().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s); LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: consider implementing `TryFrom` instead error: consider implementing `TryFrom` instead
@ -86,7 +86,7 @@ note: potential failure(s)
LL | if s.parse::<u32>().ok().unwrap() != 42 { LL | if s.parse::<u32>().ok().unwrap() != 42 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | panic!("{:?}", s); LL | panic!("{:?}", s);
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

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()` help: consider using `.to_string()`
| |
LL ~ r##"foo {} LL ~ r##"foo {}
LL + " bar"##.to_string(); LL ~ " 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

View file

@ -107,7 +107,7 @@ LL | impl<K: Hash + Eq, V> Foo<u8> for HashMap<K, V> {
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
... ...
LL | gen!(impl); LL | gen!(impl);
| ----------- in this macro invocation | ---------- in this macro invocation
| |
= note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter help: consider adding a type parameter
@ -126,7 +126,7 @@ LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>)
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
... ...
LL | gen!(fn bar); LL | gen!(fn bar);
| ------------- in this macro invocation | ------------ in this macro invocation
| |
= note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter help: consider adding a type parameter
@ -141,7 +141,7 @@ LL | pub fn $name(_map: &mut HashMap<i32, i32>, _set: &mut HashSet<i32>)
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
... ...
LL | gen!(fn bar); LL | gen!(fn bar);
| ------------- in this macro invocation | ------------ in this macro invocation
| |
= note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `gen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider adding a type parameter help: consider adding a type parameter

View file

@ -25,7 +25,7 @@ LL | | }
| |_____________^ | |_____________^
... ...
LL | b!(); LL | b!();
| ----- in this macro invocation | ---- in this macro invocation
| |
= note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -5,7 +5,7 @@ LL | std::mem::replace($s, Default::default())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... ...
LL | take!(s); LL | take!(s);
| --------- in this macro invocation | -------- in this macro invocation
| |
= note: `-D clippy::mem-replace-with-default` implied by `-D warnings` = note: `-D clippy::mem-replace-with-default` implied by `-D warnings`
= note: this error originates in the macro `take` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `take` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -91,7 +91,7 @@ note: first possible panic found here
--> $DIR/missing_panics_doc.rs:39:5 --> $DIR/missing_panics_doc.rs:39:5
| |
LL | assert_eq!(x, 0); LL | assert_eq!(x, 0);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: docs for function which may panic missing `# Panics` section error: docs for function which may panic missing `# Panics` section
@ -107,7 +107,7 @@ note: first possible panic found here
--> $DIR/missing_panics_doc.rs:45:5 --> $DIR/missing_panics_doc.rs:45:5
| |
LL | assert_ne!(x, 0); LL | assert_ne!(x, 0);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -13,7 +13,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:9:9 --> $DIR/panic_in_result_fn.rs:9:9
| |
LL | panic!("error"); LL | panic!("error");
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -30,7 +30,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:14:9 --> $DIR/panic_in_result_fn.rs:14:9
| |
LL | unimplemented!(); LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -47,7 +47,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:19:9 --> $DIR/panic_in_result_fn.rs:19:9
| |
LL | unreachable!(); LL | unreachable!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
= note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -64,7 +64,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:24:9 --> $DIR/panic_in_result_fn.rs:24:9
| |
LL | todo!("Finish this"); LL | todo!("Finish this");
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -81,7 +81,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:55:5 --> $DIR/panic_in_result_fn.rs:55:5
| |
LL | panic!("error"); LL | panic!("error");
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -98,7 +98,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn.rs:69:5 --> $DIR/panic_in_result_fn.rs:69:5
| |
LL | todo!("finish main method"); LL | todo!("finish main method");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -14,7 +14,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn_assertions.rs:9:9 --> $DIR/panic_in_result_fn_assertions.rs:9:9
| |
LL | assert!(x == 5, "wrong argument"); LL | assert!(x == 5, "wrong argument");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -32,7 +32,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn_assertions.rs:15:9 --> $DIR/panic_in_result_fn_assertions.rs:15:9
| |
LL | assert_eq!(x, 5); LL | assert_eq!(x, 5);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result` error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
@ -50,7 +50,7 @@ note: return Err() instead of panicking
--> $DIR/panic_in_result_fn_assertions.rs:21:9 --> $DIR/panic_in_result_fn_assertions.rs:21:9
| |
LL | assert_ne!(x, 1); LL | assert_ne!(x, 1);
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
= note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -2,7 +2,7 @@ error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:8:5 --> $DIR/panicking_macros.rs:8:5
| |
LL | panic!(); LL | panic!();
| ^^^^^^^^^ | ^^^^^^^^
| |
= note: `-D clippy::panic` implied by `-D warnings` = note: `-D clippy::panic` implied by `-D warnings`
@ -10,19 +10,19 @@ error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:9:5 --> $DIR/panicking_macros.rs:9:5
| |
LL | panic!("message"); LL | panic!("message");
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: `panic` should not be present in production code error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:10:5 --> $DIR/panicking_macros.rs:10:5
| |
LL | panic!("{} {}", "panic with", "multiple arguments"); LL | panic!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `todo` should not be present in production code error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:16:5 --> $DIR/panicking_macros.rs:16:5
| |
LL | todo!(); LL | todo!();
| ^^^^^^^^ | ^^^^^^^
| |
= note: `-D clippy::todo` implied by `-D warnings` = note: `-D clippy::todo` implied by `-D warnings`
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -31,7 +31,7 @@ error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:17:5 --> $DIR/panicking_macros.rs:17:5
| |
LL | todo!("message"); LL | todo!("message");
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -39,7 +39,7 @@ error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:18:5 --> $DIR/panicking_macros.rs:18:5
| |
LL | todo!("{} {}", "panic with", "multiple arguments"); LL | todo!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -47,7 +47,7 @@ error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:24:5 --> $DIR/panicking_macros.rs:24:5
| |
LL | unimplemented!(); LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: `-D clippy::unimplemented` implied by `-D warnings` = note: `-D clippy::unimplemented` implied by `-D warnings`
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -56,7 +56,7 @@ error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:25:5 --> $DIR/panicking_macros.rs:25:5
| |
LL | unimplemented!("message"); LL | unimplemented!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -64,7 +64,7 @@ error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:26:5 --> $DIR/panicking_macros.rs:26:5
| |
LL | unimplemented!("{} {}", "panic with", "multiple arguments"); LL | unimplemented!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -72,7 +72,7 @@ error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:32:5 --> $DIR/panicking_macros.rs:32:5
| |
LL | unreachable!(); LL | unreachable!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= note: `-D clippy::unreachable` implied by `-D warnings` = note: `-D clippy::unreachable` implied by `-D warnings`
= note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -81,7 +81,7 @@ error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:33:5 --> $DIR/panicking_macros.rs:33:5
| |
LL | unreachable!("message"); LL | unreachable!("message");
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `$crate::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -89,7 +89,7 @@ error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:34:5 --> $DIR/panicking_macros.rs:34:5
| |
LL | unreachable!("{} {}", "panic with", "multiple arguments"); LL | unreachable!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -97,13 +97,13 @@ error: `panic` should not be present in production code
--> $DIR/panicking_macros.rs:40:5 --> $DIR/panicking_macros.rs:40:5
| |
LL | panic!(); LL | panic!();
| ^^^^^^^^^ | ^^^^^^^^
error: `todo` should not be present in production code error: `todo` should not be present in production code
--> $DIR/panicking_macros.rs:41:5 --> $DIR/panicking_macros.rs:41:5
| |
LL | todo!(); LL | todo!();
| ^^^^^^^^ | ^^^^^^^
| |
= note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `todo` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -111,7 +111,7 @@ error: `unimplemented` should not be present in production code
--> $DIR/panicking_macros.rs:42:5 --> $DIR/panicking_macros.rs:42:5
| |
LL | unimplemented!(); LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unimplemented` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -119,7 +119,7 @@ error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:43:5 --> $DIR/panicking_macros.rs:43:5
| |
LL | unreachable!(); LL | unreachable!();
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
= note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `unreachable` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -70,7 +70,7 @@ LL | Some(_) => (),
| ^^^^^^^ | ^^^^^^^
... ...
LL | matching_macro!(value); LL | matching_macro!(value);
| ----------------------- in this macro invocation | ---------------------- in this macro invocation
| |
= help: use `*` to dereference the match expression or explicitly match against a `&_` pattern and adjust the enclosed variable bindings = help: use `*` to dereference the match expression or explicitly match against a `&_` pattern and adjust the enclosed variable bindings
= note: this error originates in the macro `matching_macro` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `matching_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -37,7 +37,7 @@ LL | let ref _y = 42;
| ----^^^^^^------ help: try: `let _y = &42;` | ----^^^^^^------ help: try: `let _y = &42;`
... ...
LL | gen_binding!(); LL | gen_binding!();
| --------------- in this macro invocation | -------------- in this macro invocation
| |
= note: this error originates in the macro `gen_binding` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `gen_binding` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -13,7 +13,7 @@ LL | fn fun_example(ref _x: usize) {}
| ^^^^^^ | ^^^^^^
... ...
LL | gen_function!(); LL | gen_function!();
| ---------------- in this macro invocation | --------------- in this macro invocation
| |
= note: this error originates in the macro `gen_function` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `gen_function` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -35,7 +35,7 @@ LL | Err(_) => Err(1)?,
| ^^^^^^^ help: try this: `return Err(1)` | ^^^^^^^ help: try this: `return Err(1)`
... ...
LL | try_validation!(Ok::<_, i32>(5)); LL | try_validation!(Ok::<_, i32>(5));
| --------------------------------- in this macro invocation | -------------------------------- in this macro invocation
| |
= note: this error originates in the macro `try_validation` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `try_validation` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -46,7 +46,7 @@ LL | Err(_) => Err(ret_one!())?,
| ^^^^^^^^^^^^^^^^ help: try this: `return Err(ret_one!())` | ^^^^^^^^^^^^^^^^ help: try this: `return Err(ret_one!())`
... ...
LL | try_validation_in_macro!(Ok::<_, i32>(5)); LL | try_validation_in_macro!(Ok::<_, i32>(5));
| ------------------------------------------ in this macro invocation | ----------------------------------------- in this macro invocation
| |
= note: this error originates in the macro `try_validation_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `try_validation_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -32,7 +32,7 @@ LL | | },
... | ... |
LL | | } LL | | }
LL | | ); LL | | );
| |______^ | |_____^
| |
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -46,7 +46,7 @@ LL | | },
... | ... |
LL | | } LL | | }
LL | | ); LL | | );
| |______^ | |_____^
| |
= note: this error originates in the macro `$crate::assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -60,7 +60,7 @@ LL | | },
... | ... |
LL | | } LL | | }
LL | | ); LL | | );
| |______^ | |_____^
| |
= note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -74,7 +74,7 @@ LL | | },
... | ... |
LL | | } LL | | }
LL | | ); LL | | );
| |______^ | |_____^
| |
= note: this error originates in the macro `$crate::assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)