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
12 changes: 6 additions & 6 deletions web/platform/utils/metaphase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const isEnumItem = (
return "enum" in item.inner;
};

const removePrefix = (name: string): string => {
return name
const removePrefix = (path: string): string => {
return path
.replace(/^(crate::)?stores::/, "")
.replace(/^std::collections::/, "");
};
Expand Down Expand Up @@ -146,8 +146,8 @@ const generateResolvedPathJsonExample = (
crate: Crate,
depth: number,
): JsonExample => {
const { name, id, args } = type.resolved_path;
const cleanName = removePrefix(name);
const { path, id, args } = type.resolved_path;
const cleanName = removePrefix(path);
switch (cleanName) {
case "Option":
return null;
Expand Down Expand Up @@ -311,7 +311,7 @@ const generateTypeDescription = (type: Type): string => {
}

if (isResolvedPathType(type)) {
const { name, args } = type.resolved_path;
const { path, args } = type.resolved_path;

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

const finalTypeName = removePrefix(name.split("::").pop() || name);
const finalTypeName = removePrefix(path.split("::").pop() || path);

switch (finalTypeName) {
case "Option":
Expand Down
2 changes: 1 addition & 1 deletion web/platform/utils/rustdoc_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export type Type =
};

export interface Path {
name: string;
path: string;
id: Id;
args: GenericArgs | null;
}
Expand Down
Loading