Precompute vector length in smart_resolve_path_fragment

This commit is contained in:
Dániel Buga 2020-12-20 21:38:41 +01:00
parent 93d5a8025d
commit 62f593bda9

View File

@ -1891,8 +1891,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
self.r.trait_map.insert(id, traits);
}
let mut std_path = vec![Segment::from_ident(Ident::with_dummy_span(sym::std))];
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) {