Skip to content

Commit

Permalink
Made Path::name only have item name rather than full name
Browse files Browse the repository at this point in the history
  • Loading branch information
AS1100K committed Jan 14, 2025
1 parent 480eec0 commit 2c4aee9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ impl FromClean<clean::Type> for Type {
impl FromClean<clean::Path> for Path {
fn from_clean(path: clean::Path, renderer: &JsonRenderer<'_>) -> Path {
Path {
name: path.whole_name(),
name: path.last_opt().map_or(String::from(""), |s| String::from(s.as_str())),
id: renderer.id_from_item_default(path.def_id().into()),
args: path.segments.last().map(|args| Box::new(args.clone().args.into_json(renderer))),
}
Expand Down
2 changes: 1 addition & 1 deletion src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc
/// This integer is incremented with every breaking change to the API,
/// and is returned along with the JSON blob as [`Crate::format_version`].
/// Consuming code should assert that this value matches the format version(s) that it supports.
pub const FORMAT_VERSION: u32 = 37;
pub const FORMAT_VERSION: u32 = 38;

/// The root of the emitted JSON blob.
///
Expand Down
2 changes: 1 addition & 1 deletion tests/rustdoc-json/return_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod secret {
}

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

0 comments on commit 2c4aee9

Please sign in to comment.