Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustdoc/clean/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
.and_then(|trait_| {
ty_to_traits
.get(&ty)
.map(|bounds| bounds.contains(&strip_path_generics(trait_.clone())))
.map(|bounds| bounds.contains(&strip_path_generics(trait_)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we get fresh Path from get_trait_path() so no need to clone in again

})
.unwrap_or(false)
{
Expand Down
15 changes: 5 additions & 10 deletions src/librustdoc/clean/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down