don't alloc Path and mutate it inplace
This commit is contained in:
parent
58457bbfd3
commit
8869dbc2a0
@ -505,7 +505,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
|||||||
.and_then(|trait_| {
|
.and_then(|trait_| {
|
||||||
ty_to_traits
|
ty_to_traits
|
||||||
.get(&ty)
|
.get(&ty)
|
||||||
.map(|bounds| bounds.contains(&strip_path_generics(trait_.clone())))
|
.map(|bounds| bounds.contains(&strip_path_generics(trait_)))
|
||||||
})
|
})
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
{
|
{
|
||||||
|
@ -141,17 +141,12 @@ pub(super) fn external_path(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Remove the generic arguments from a path.
|
/// Remove the generic arguments from a path.
|
||||||
crate fn strip_path_generics(path: Path) -> Path {
|
crate fn strip_path_generics(mut path: Path) -> Path {
|
||||||
let segments = path
|
for ps in path.segments.iter_mut() {
|
||||||
.segments
|
ps.args = GenericArgs::AngleBracketed { args: vec![], bindings: vec![] }
|
||||||
.iter()
|
}
|
||||||
.map(|s| PathSegment {
|
|
||||||
name: s.name,
|
|
||||||
args: GenericArgs::AngleBracketed { args: vec![], bindings: vec![] },
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
Path { res: path.res, segments }
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {
|
crate fn qpath_to_string(p: &hir::QPath<'_>) -> String {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user