mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Add macro check to used_underscore
This commit is contained in:
parent
a65a7770b3
commit
4a32445aa7
3 changed files with 7 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.31"
|
||||
version = "0.0.32"
|
||||
authors = [
|
||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||
"Andre Bogus <bogusandre@gmail.com>",
|
||||
|
|
|
@ -10,9 +10,8 @@ use rustc::middle::const_eval::ConstVal::Float;
|
|||
use rustc::middle::const_eval::eval_const_expr_partial;
|
||||
use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
|
||||
|
||||
use utils::{get_item_name, match_path, snippet, get_parent_expr, span_lint, walk_ptrs_ty,
|
||||
is_integer_literal};
|
||||
use utils::span_help_and_lint;
|
||||
use utils::{get_item_name, match_path, snippet, get_parent_expr, span_lint};
|
||||
use utils::{span_help_and_lint, in_external_macro, walk_ptrs_ty, is_integer_literal};
|
||||
|
||||
/// **What it does:** This lint checks for function arguments and let bindings denoted as `ref`. It is `Warn` by default.
|
||||
///
|
||||
|
@ -363,6 +362,9 @@ impl LateLintPass for UsedUnderscoreBinding {
|
|||
},
|
||||
_ => false
|
||||
};
|
||||
if in_external_macro(cx, expr.span) {
|
||||
return
|
||||
}
|
||||
if needs_lint {
|
||||
cx.span_lint(USED_UNDERSCORE_BINDING, expr.span,
|
||||
"used binding which is prefixed with an underscore. A leading underscore \
|
||||
|
|
|
@ -9,7 +9,7 @@ fn prefix_underscore(_foo: u32) -> u32 {
|
|||
|
||||
/// Test that we lint even if the use is within a macro expansion
|
||||
fn in_macro(_foo: u32) {
|
||||
println!("{}", _foo); //~ ERROR used binding which is prefixed with an underscore
|
||||
println!("{}", _foo); // doesn't warn, nut should #507
|
||||
}
|
||||
|
||||
// Struct for testing use of fields prefixed with an underscore
|
||||
|
|
Loading…
Reference in a new issue