mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 08:30:45 +00:00
Rustup to *1.10.0-nightly (476fe6eef 2016-05-21)*
This commit is contained in:
parent
6dd608e53e
commit
ac2e175c1b
3 changed files with 14 additions and 15 deletions
|
@ -208,15 +208,16 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
|
|||
let db = span_lint(cx,
|
||||
SHADOW_SAME,
|
||||
span,
|
||||
&format!("{} is shadowed by itself in {}",
|
||||
&format!("`{}` is shadowed by itself in `{}`",
|
||||
snippet(cx, pattern_span, "_"),
|
||||
snippet(cx, expr.span, "..")));
|
||||
|
||||
note_orig(cx, db, SHADOW_SAME, prev_span);
|
||||
} else if contains_self(name, expr) {
|
||||
let db = span_note_and_lint(cx,
|
||||
SHADOW_REUSE,
|
||||
pattern_span,
|
||||
&format!("{} is shadowed by {} which reuses the original value",
|
||||
&format!("`{}` is shadowed by `{}` which reuses the original value",
|
||||
snippet(cx, pattern_span, "_"),
|
||||
snippet(cx, expr.span, "..")),
|
||||
expr.span,
|
||||
|
@ -226,7 +227,7 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
|
|||
let db = span_note_and_lint(cx,
|
||||
SHADOW_UNRELATED,
|
||||
pattern_span,
|
||||
&format!("{} is shadowed by {}",
|
||||
&format!("`{}` is shadowed by `{}`",
|
||||
snippet(cx, pattern_span, "_"),
|
||||
snippet(cx, expr.span, "..")),
|
||||
expr.span,
|
||||
|
|
|
@ -493,10 +493,8 @@ fn single_char_pattern() {
|
|||
fn temporary_cstring() {
|
||||
use std::ffi::CString;
|
||||
|
||||
( // extra parenthesis to better test spans
|
||||
CString::new("foo").unwrap().as_ptr();
|
||||
//~^ ERROR you are getting the inner pointer of a temporary `CString`
|
||||
//~| NOTE that pointer will be invalid outside this expression
|
||||
CString::new("foo").unwrap()
|
||||
//~^ HELP assign the `CString` to a variable to extend its lifetime
|
||||
).as_ptr();
|
||||
//~| HELP assign the `CString` to a variable to extend its lifetime
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@ fn first(x: (isize, isize)) -> isize { x.0 }
|
|||
|
||||
fn main() {
|
||||
let mut x = 1;
|
||||
let x = &mut x; //~ERROR x is shadowed by itself in &mut x
|
||||
let x = { x }; //~ERROR x is shadowed by itself in { x }
|
||||
let x = (&*x); //~ERROR x is shadowed by itself in &*x
|
||||
let x = { *x + 1 }; //~ERROR x is shadowed by { *x + 1 } which reuses
|
||||
let x = id(x); //~ERROR x is shadowed by id(x) which reuses
|
||||
let x = (1, x); //~ERROR x is shadowed by (1, x) which reuses
|
||||
let x = first(x); //~ERROR x is shadowed by first(x) which reuses
|
||||
let x = &mut x; //~ERROR `x` is shadowed by itself in `&mut x`
|
||||
let x = { x }; //~ERROR `x` is shadowed by itself in `{ x }`
|
||||
let x = (&*x); //~ERROR `x` is shadowed by itself in `(&*x)`
|
||||
let x = { *x + 1 }; //~ERROR `x` is shadowed by `{ *x + 1 }` which reuses
|
||||
let x = id(x); //~ERROR `x` is shadowed by `id(x)` which reuses
|
||||
let x = (1, x); //~ERROR `x` is shadowed by `(1, x)` which reuses
|
||||
let x = first(x); //~ERROR `x` is shadowed by `first(x)` which reuses
|
||||
let y = 1;
|
||||
let x = y; //~ERROR x is shadowed by y
|
||||
let x = y; //~ERROR `x` is shadowed by `y`
|
||||
|
||||
let o = Some(1u8);
|
||||
|
||||
|
|
Loading…
Reference in a new issue