Move std_path construction into condition

This commit is contained in:
Dániel Buga 2020-12-20 23:55:03 +01:00
parent 66c2872901
commit 6d71cc6750

View File

@ -1891,12 +1891,11 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
self.r.trait_map.insert(id, traits);
}
let mut std_path = Vec::with_capacity(1 + path.len());
std_path.push(Segment::from_ident(Ident::with_dummy_span(sym::std)));
std_path.extend(path);
if self.r.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {
let mut std_path = Vec::with_capacity(1 + path.len());
std_path.push(Segment::from_ident(Ident::with_dummy_span(sym::std)));
std_path.extend(path);
if let PathResult::Module(_) | PathResult::NonModule(_) =
self.resolve_path(&std_path, Some(ns), false, span, CrateLint::No)
{