Skip to content

Commit 19f6130

Browse files
committed
Remove unnecessary path_to_string utility function.
`hir::Path` already implements `Display`, which calls `print::path_to_string` which results in the same output.
1 parent 735a25a commit 19f6130

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/librustdoc/clean/mod.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -2213,20 +2213,6 @@ impl Clean<PathSegment> for hir::PathSegment {
22132213
}
22142214
}
22152215

2216-
fn path_to_string(p: &hir::Path) -> String {
2217-
let mut s = String::new();
2218-
let mut first = true;
2219-
for i in p.segments.iter().map(|x| x.name.as_str()) {
2220-
if !first || p.global {
2221-
s.push_str("::");
2222-
} else {
2223-
first = false;
2224-
}
2225-
s.push_str(&i);
2226-
}
2227-
s
2228-
}
2229-
22302216
impl Clean<String> for ast::Name {
22312217
fn clean(&self, _: &DocContext) -> String {
22322218
self.to_string()
@@ -2681,11 +2667,12 @@ fn name_from_pat(p: &hir::Pat) -> String {
26812667
match p.node {
26822668
PatKind::Wild => "_".to_string(),
26832669
PatKind::Binding(_, ref p, _) => p.node.to_string(),
2684-
PatKind::TupleStruct(ref p, ..) | PatKind::Path(None, ref p) => path_to_string(p),
2670+
PatKind::TupleStruct(ref p, ..) | PatKind::Path(None, ref p) => p.to_string(),
26852671
PatKind::Path(..) => panic!("tried to get argument name from qualified PatKind::Path, \
26862672
which is not allowed in function arguments"),
26872673
PatKind::Struct(ref name, ref fields, etc) => {
2688-
format!("{} {{ {}{} }}", path_to_string(name),
2674+
format!("{} {{ {}{} }}",
2675+
name,
26892676
fields.iter().map(|&Spanned { node: ref fp, .. }|
26902677
format!("{}: {}", fp.name, name_from_pat(&*fp.pat)))
26912678
.collect::<Vec<String>>().join(", "),

0 commit comments

Comments
 (0)