This commit is contained in:
Takayuki Nakata 2020-07-21 08:25:11 +09:00
parent 14a4e3bcc8
commit b7ceb4d3d7
2 changed files with 4 additions and 3 deletions

View File

@ -1081,7 +1081,8 @@ fn has_mutable_variables<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) ->
def_id.expect_local(), def_id.expect_local(),
cx.param_env, cx.param_env,
cx.typeck_results(), cx.typeck_results(),
).walk_expr(expr); )
.walk_expr(expr);
}); });
delegate.found_mutable delegate.found_mutable
@ -1271,7 +1272,7 @@ fn detect_same_item_push<'tcx>(
SAME_ITEM_PUSH, SAME_ITEM_PUSH,
vec.span, vec.span,
"it looks like the same item is being pushed into this Vec", "it looks like the same item is being pushed into this Vec",
None, None,
&format!( &format!(
"try using vec![{};SIZE] or {}.resize(NEW_SIZE, {})", "try using vec![{};SIZE] or {}.resize(NEW_SIZE, {})",
item_str, vec_str, item_str item_str, vec_str, item_str

View File

@ -80,7 +80,7 @@ fn main() {
} }
let mut vec_a: Vec<A> = Vec::new(); let mut vec_a: Vec<A> = Vec::new();
for i in 0..30 { for i in 0..30 {
vec_a.push(A{kind: i}); vec_a.push(A { kind: i });
} }
let mut vec12: Vec<u8> = Vec::new(); let mut vec12: Vec<u8> = Vec::new();
for a in vec_a { for a in vec_a {