Skip to content

Commit f63ed56

Browse files
committed
Made Path::name only have item name rather than full name
1 parent 480eec0 commit f63ed56

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ impl FromClean<clean::Type> for Type {
620620
impl FromClean<clean::Path> for Path {
621621
fn from_clean(path: clean::Path, renderer: &JsonRenderer<'_>) -> Path {
622622
Path {
623-
name: path.whole_name(),
623+
name: path.last_opt().map_or(String::from(""), |s| String::from(s.as_str())),
624624
id: renderer.id_from_item_default(path.def_id().into()),
625625
args: path.segments.last().map(|args| Box::new(args.clone().args.into_json(renderer))),
626626
}

Diff for: tests/rustdoc-json/return_private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod secret {
66
}
77

88
//@ has "$.index[*][?(@.name=='get_secret')].inner.function"
9-
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.name" \"secret::Secret\"
9+
//@ is "$.index[*][?(@.name=='get_secret')].inner.function.sig.output.resolved_path.name" \"Secret\"
1010
pub fn get_secret() -> secret::Secret {
1111
secret::Secret
1212
}

0 commit comments

Comments
 (0)