Skip to content

Commit f5f637d

Browse files
committed
Rustup to *1.10.0-nightly (764ef92 2016-05-19)*
1 parent e912858 commit f5f637d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ fn lint_or_fun_call(cx: &LateContext, expr: &hir::Expr, name: &str, args: &[P<hi
511511
return;
512512
}
513513
}
514-
// (path, fn_has_argument, methods)
514+
// (path, fn_has_argument, methods, suffix)
515515
let know_types: &[(&[_], _, &[_], _)] = &[(&paths::BTREEMAP_ENTRY, false, &["or_insert"], "with"),
516516
(&paths::HASHMAP_ENTRY, false, &["or_insert"], "with"),
517517
(&paths::OPTION,

src/vec.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ impl LateLintPass for UselessVec {
3838
let TypeVariants::TySlice(..) = ty.ty.sty,
3939
let ExprAddrOf(_, ref addressee) = expr.node,
4040
], {
41-
check_vec_macro(cx, expr, addressee);
41+
check_vec_macro(cx, addressee, expr.span);
4242
}}
4343

4444
// search for `for _ in vec![…]`
4545
if let Some((_, arg, _)) = recover_for_loop(expr) {
46-
check_vec_macro(cx, arg, arg);
46+
// report the error around the `vec!` not inside `<std macros>:`
47+
let span = cx.sess().codemap().source_callsite(arg.span);
48+
check_vec_macro(cx, arg, span);
4749
}
4850
}
4951
}
5052

51-
fn check_vec_macro(cx: &LateContext, expr: &Expr, vec: &Expr) {
53+
fn check_vec_macro(cx: &LateContext, vec: &Expr, span: Span) {
5254
if let Some(vec_args) = unexpand_vec(cx, vec) {
5355
let snippet = match vec_args {
5456
VecArgs::Repeat(elem, len) => {
@@ -69,8 +71,8 @@ fn check_vec_macro(cx: &LateContext, expr: &Expr, vec: &Expr) {
6971
}
7072
};
7173

72-
span_lint_and_then(cx, USELESS_VEC, expr.span, "useless use of `vec!`", |db| {
73-
db.span_suggestion(expr.span, "you can use a slice directly", snippet);
74+
span_lint_and_then(cx, USELESS_VEC, span, "useless use of `vec!`", |db| {
75+
db.span_suggestion(span, "you can use a slice directly", snippet);
7476
});
7577
}
7678
}

tests/compile-fail/mut_mut.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fn less_fun(x : *mut *mut u32) {
1818

1919
macro_rules! mut_ptr {
2020
($p:expr) => { &mut $p }
21+
//~^ ERROR generally you want to avoid `&mut &mut
2122
}
2223

2324
#[deny(mut_mut)]
@@ -30,12 +31,12 @@ fn main() {
3031

3132
if fun(x) {
3233
let y : &mut &mut &mut u32 = &mut &mut &mut 2;
33-
//~^ ERROR generally you want to avoid `&mut &mut
34-
//~^^ ERROR generally you want to avoid `&mut &mut
35-
//~^^^ ERROR generally you want to avoid `&mut &mut
36-
//~^^^^ ERROR generally you want to avoid `&mut &mut
34+
//~^ ERROR generally you want to avoid `&mut &mut
35+
//~| ERROR generally you want to avoid `&mut &mut
36+
//~| ERROR generally you want to avoid `&mut &mut
37+
//~| ERROR generally you want to avoid `&mut &mut
3738
***y + **x;
3839
}
3940

40-
let mut z = mut_ptr!(&mut 3u32); //~ERROR generally you want to avoid `&mut &mut
41+
let mut z = mut_ptr!(&mut 3u32); //~ NOTE in this expansion of mut_ptr!
4142
}

0 commit comments

Comments
 (0)