Address internal lints

This commit is contained in:
Yechan Bae 2021-10-09 05:59:53 -04:00
parent 2181387c3a
commit 03fed75c89
2 changed files with 3 additions and 3 deletions

View file

@ -113,7 +113,7 @@ fn handle_uninit_vec_pair(
UNINIT_VEC,
vec![call_span, maybe_init_or_reserve.span],
"calling `set_len()` on empty `Vec` creates out-of-bound values",
)
);
}
}
}

View file

@ -11,7 +11,7 @@ use rustc_hir::{
Arm, Block, BorrowKind, Expr, ExprKind, HirId, LoopSource, MatchSource, Node, Pat, QPath, StmtKind, UnOp,
};
use rustc_lint::LateContext;
use rustc_span::{sym, ExpnKind, Span, Symbol};
use rustc_span::{sym, symbol, ExpnKind, Span, Symbol};
/// The essential nodes of a desugared for loop as well as the entire span:
/// `for pat in arg { body }` becomes `(pat, arg, body)`. Return `(pat, arg, body, span)`.
@ -658,7 +658,7 @@ pub fn get_vec_init_kind<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -
{
if name.ident.name == sym::new {
return Some(VecInitKind::New);
} else if name.ident.name.as_str() == "default" {
} else if name.ident.name == symbol::kw::Default {
return Some(VecInitKind::Default);
} else if name.ident.name.as_str() == "with_capacity" {
let arg = args.get(0)?;