deny duplicate matcher bindings by default
This commit is contained in:
parent
237bf3244f
commit
9f14e146ed
@ -354,7 +354,7 @@ declare_lint! {
|
|||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
pub DUPLICATE_MATCHER_BINDING_NAME,
|
pub DUPLICATE_MATCHER_BINDING_NAME,
|
||||||
Warn,
|
Deny,
|
||||||
"duplicate macro matcher binding name"
|
"duplicate macro matcher binding name"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,6 +464,7 @@ impl LintPass for HardwiredLints {
|
|||||||
DEPRECATED_IN_FUTURE,
|
DEPRECATED_IN_FUTURE,
|
||||||
AMBIGUOUS_ASSOCIATED_ITEMS,
|
AMBIGUOUS_ASSOCIATED_ITEMS,
|
||||||
NESTED_IMPL_TRAIT,
|
NESTED_IMPL_TRAIT,
|
||||||
|
DUPLICATE_MATCHER_BINDING_NAME,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// compile-pass
|
// compile-pass
|
||||||
|
|
||||||
#![allow(unused_macros)]
|
#![allow(unused_macros)]
|
||||||
|
#![warn(duplicate_matcher_binding_name)]
|
||||||
|
|
||||||
macro_rules! foo1 {
|
macro_rules! foo1 {
|
||||||
($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding
|
($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
warning: duplicate matcher binding
|
warning: duplicate matcher binding
|
||||||
--> $DIR/macro-multiple-matcher-bindings.rs:11:6
|
--> $DIR/macro-multiple-matcher-bindings.rs:12:6
|
||||||
|
|
|
|
||||||
LL | ($a:ident, $a:ident) => {};
|
LL | ($a:ident, $a:ident) => {};
|
||||||
| ^^^^^^^^ ^^^^^^^^
|
| ^^^^^^^^ ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: #[warn(duplicate_matcher_binding_name)] on by default
|
note: lint level defined here
|
||||||
|
--> $DIR/macro-multiple-matcher-bindings.rs:9:9
|
||||||
|
|
|
||||||
|
LL | #![warn(duplicate_matcher_binding_name)]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
||||||
|
|
||||||
warning: duplicate matcher binding
|
warning: duplicate matcher binding
|
||||||
--> $DIR/macro-multiple-matcher-bindings.rs:12:6
|
--> $DIR/macro-multiple-matcher-bindings.rs:13:6
|
||||||
|
|
|
|
||||||
LL | ($a:ident, $a:path) => {};
|
LL | ($a:ident, $a:path) => {};
|
||||||
| ^^^^^^^^ ^^^^^^^
|
| ^^^^^^^^ ^^^^^^^
|
||||||
@ -18,7 +22,7 @@ LL | ($a:ident, $a:path) => {};
|
|||||||
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
||||||
|
|
||||||
warning: duplicate matcher binding
|
warning: duplicate matcher binding
|
||||||
--> $DIR/macro-multiple-matcher-bindings.rs:21:6
|
--> $DIR/macro-multiple-matcher-bindings.rs:22:6
|
||||||
|
|
|
|
||||||
LL | ($a:ident, $($a:ident),*) => {};
|
LL | ($a:ident, $($a:ident),*) => {};
|
||||||
| ^^^^^^^^ ^^^^^^^^
|
| ^^^^^^^^ ^^^^^^^^
|
||||||
@ -27,7 +31,7 @@ LL | ($a:ident, $($a:ident),*) => {};
|
|||||||
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
|
||||||
|
|
||||||
warning: duplicate matcher binding
|
warning: duplicate matcher binding
|
||||||
--> $DIR/macro-multiple-matcher-bindings.rs:22:8
|
--> $DIR/macro-multiple-matcher-bindings.rs:23:8
|
||||||
|
|
|
|
||||||
LL | ($($a:ident)+ # $($($a:path),+);*) => {};
|
LL | ($($a:ident)+ # $($($a:path),+);*) => {};
|
||||||
| ^^^^^^^^ ^^^^^^^
|
| ^^^^^^^^ ^^^^^^^
|
||||||
|
Loading…
Reference in New Issue
Block a user