Skip to content

Commit

Permalink
Reword lint message
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed May 6, 2024
1 parent da703dd commit 064aa5a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/macro_metavars_in_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<'tcx> LateLintPass<'tcx> for ExprMetavarsInUnsafe {
MACRO_METAVARS_IN_UNSAFE,
id,
span,
"this unsafe block in a macro expands metavariables",
"this macro expands metavariables in an unsafe block",
|diag| {
diag.note("this allows the user of the macro to write unsafe code outside of an unsafe block");
diag.help(
Expand Down
28 changes: 14 additions & 14 deletions tests/ui-toml/macro_metavars_in_unsafe/default/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ macro_rules! allow_works {
macro_rules! simple {
($v:expr) => {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
dbg!($v);
}
};
Expand All @@ -28,7 +28,7 @@ macro_rules! simple {
macro_rules! raw_symbol {
($r#mod:expr, $r#unsafe:expr) => {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$r#mod;
}
$r#unsafe;
Expand All @@ -40,7 +40,7 @@ macro_rules! multilevel_unsafe {
($v:expr) => {
unsafe {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$v;
}
}
Expand All @@ -65,7 +65,7 @@ macro_rules! in_function_with_unsafe {
unsafe {
fn f() {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$v;
}
}
Expand Down Expand Up @@ -93,7 +93,7 @@ macro_rules! const_generic_in_struct {
const M: i32 = {
1;
unsafe { $inside_unsafe }
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
},
const N: i32 = { $outside_unsafe },
>;
Expand All @@ -108,7 +108,7 @@ macro_rules! fn_with_const_generic {
fn f<const N: usize>() {
$outside_unsafe;
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$inside_unsafe;
}
}
Expand All @@ -120,7 +120,7 @@ macro_rules! fn_with_const_generic {
macro_rules! variables {
($inside_unsafe:expr, $outside_unsafe:expr) => {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$inside_unsafe;
let inside_unsafe = 1;
inside_unsafe;
Expand All @@ -135,7 +135,7 @@ macro_rules! variables {
macro_rules! multiple_matchers {
($inside_unsafe:expr, $outside_unsafe:expr) => {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$inside_unsafe;
}
$outside_unsafe;
Expand All @@ -144,7 +144,7 @@ macro_rules! multiple_matchers {
$(
$v;
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$x;
}
);+
Expand All @@ -156,11 +156,11 @@ macro_rules! multiple_unsafe_blocks {
($w:expr, $x:expr, $y:expr) => {
$w;
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$x;
}
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$x;
$y;
}
Expand All @@ -169,7 +169,7 @@ macro_rules! multiple_unsafe_blocks {

pub macro macro2_0($v:expr) {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$v;
}
}
Expand Down Expand Up @@ -220,7 +220,7 @@ macro_rules! unsafe_from_root_ctxt {
macro_rules! nested_macro_helper {
($v:expr) => {{
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
$v;
}
}};
Expand All @@ -230,7 +230,7 @@ macro_rules! nested_macro_helper {
macro_rules! nested_macros {
($v:expr, $v2:expr) => {{
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
nested_macro_helper!($v);
$v;
}
Expand Down
28 changes: 14 additions & 14 deletions tests/ui-toml/macro_metavars_in_unsafe/default/test.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:19:9
|
LL | / unsafe {
Expand All @@ -13,7 +13,7 @@ LL | | }
= note: `-D clippy::macro-metavars-in-unsafe` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::macro_metavars_in_unsafe)]`

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:30:9
|
LL | / unsafe {
Expand All @@ -26,7 +26,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:42:13
|
LL | / unsafe {
Expand All @@ -39,7 +39,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:67:17
|
LL | / unsafe {
Expand All @@ -52,7 +52,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:95:21
|
LL | unsafe { $inside_unsafe }
Expand All @@ -62,7 +62,7 @@ LL | unsafe { $inside_unsafe }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:110:17
|
LL | / unsafe {
Expand All @@ -75,7 +75,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:122:9
|
LL | / unsafe {
Expand All @@ -90,7 +90,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:137:9
|
LL | / unsafe {
Expand All @@ -103,7 +103,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:146:13
|
LL | / unsafe {
Expand All @@ -116,7 +116,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:171:5
|
LL | / unsafe {
Expand All @@ -129,7 +129,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:158:9
|
LL | / unsafe {
Expand All @@ -142,7 +142,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:162:9
|
LL | / unsafe {
Expand All @@ -156,7 +156,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:222:9
|
LL | / unsafe {
Expand All @@ -169,7 +169,7 @@ LL | | }
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite

error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/default/test.rs:232:9
|
LL | / unsafe {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-toml/macro_metavars_in_unsafe/private/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
macro_rules! mac {
($v:expr) => {
unsafe {
//~^ ERROR: this unsafe block in a macro expands metavariables
//~^ ERROR: this macro expands metavariables in an unsafe block
dbg!($v);
}
};
Expand Down
2 changes: 1 addition & 1 deletion tests/ui-toml/macro_metavars_in_unsafe/private/test.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: this unsafe block in a macro expands metavariables
error: this macro expands metavariables in an unsafe block
--> tests/ui-toml/macro_metavars_in_unsafe/private/test.rs:6:9
|
LL | / unsafe {
Expand Down

0 comments on commit 064aa5a

Please sign in to comment.