Skip to content

Commit addc092

Browse files
authored
Rename name to path in rustdoc (TraceMachina#1708)
1 parent c8c9753 commit addc092

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

web/platform/utils/metaphase.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ const isEnumItem = (
7373
return "enum" in item.inner;
7474
};
7575

76-
const removePrefix = (name: string): string => {
77-
return name
76+
const removePrefix = (path: string): string => {
77+
return path
7878
.replace(/^(crate::)?stores::/, "")
7979
.replace(/^std::collections::/, "");
8080
};
@@ -146,8 +146,8 @@ const generateResolvedPathJsonExample = (
146146
crate: Crate,
147147
depth: number,
148148
): JsonExample => {
149-
const { name, id, args } = type.resolved_path;
150-
const cleanName = removePrefix(name);
149+
const { path, id, args } = type.resolved_path;
150+
const cleanName = removePrefix(path);
151151
switch (cleanName) {
152152
case "Option":
153153
return null;
@@ -311,7 +311,7 @@ const generateTypeDescription = (type: Type): string => {
311311
}
312312

313313
if (isResolvedPathType(type)) {
314-
const { name, args } = type.resolved_path;
314+
const { path, args } = type.resolved_path;
315315

316316
const getInnerType = (index: number): string => {
317317
if (args && "angle_bracketed" in args) {
@@ -323,7 +323,7 @@ const generateTypeDescription = (type: Type): string => {
323323
return "Unknown";
324324
};
325325

326-
const finalTypeName = removePrefix(name.split("::").pop() || name);
326+
const finalTypeName = removePrefix(path.split("::").pop() || path);
327327

328328
switch (finalTypeName) {
329329
case "Option":

web/platform/utils/rustdoc_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export type Type =
290290
};
291291

292292
export interface Path {
293-
name: string;
293+
path: string;
294294
id: Id;
295295
args: GenericArgs | null;
296296
}

0 commit comments

Comments
 (0)