Skip to content

Commit 62f593b

Browse files
committed
Precompute vector length in smart_resolve_path_fragment
1 parent 93d5a80 commit 62f593b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_resolve/src/late.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,8 +1891,9 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
18911891
self.r.trait_map.insert(id, traits);
18921892
}
18931893

1894-
let mut std_path = vec![Segment::from_ident(Ident::with_dummy_span(sym::std))];
1894+
let mut std_path = Vec::with_capacity(1 + path.len());
18951895

1896+
std_path.push(Segment::from_ident(Ident::with_dummy_span(sym::std)));
18961897
std_path.extend(path);
18971898

18981899
if self.r.primitive_type_table.primitive_types.contains_key(&path[0].ident.name) {

0 commit comments

Comments
 (0)