don't alloc Path and mutate it inplace
This commit is contained in:
parent
58457bbfd3
commit
8869dbc2a0
2 changed files with 6 additions and 11 deletions
|
@ -141,17 +141,12 @@ pub(super) fn external_path(
|
|||
}
|
||||
|
||||
/// Remove the generic arguments from a path.
|
||||
crate fn strip_path_generics(path: Path) -> Path {
|
||||
let segments = path
|
||||
.segments
|
||||
.iter()
|
||||
.map(|s| PathSegment {
|
||||
name: s.name,
|
||||
args: GenericArgs::AngleBracketed { args: vec![], bindings: vec![] },
|
||||
})
|
||||
.collect();
|
||||
crate fn strip_path_generics(mut path: Path) -> Path {
|
||||
for ps in path.segments.iter_mut() {
|
||||
ps.args = GenericArgs::AngleBracketed { args: vec![], bindings: vec![] }
|
||||
}
|
||||
|
||||
Path { res: path.res, segments }
|
||||
path
|
||||
}
|
||||
|
||||
crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue