Skip to content

Commit de5e3cf

Browse files
committed
fix incorrect committed rust and run prettier
1 parent cfa15d4 commit de5e3cf

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

crates/ide/src/view_memory_layout.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,28 @@ pub(crate) fn view_memory_layout(
145145
}
146146
}
147147

148-
ty.layout(db).map(|layout| {
149-
let item_name = match def {
150-
Definition::Local(l) => l.name(db).as_str().unwrap().to_owned(),
151-
_ => "[ROOT]".to_owned(),
152-
};
153-
154-
let typename = ty.display(db).to_string();
155-
156-
let mut nodes = vec![MemoryLayoutNode {
157-
item_name,
158-
typename: typename.clone(),
159-
size: layout.size(),
160-
offset: 0,
161-
alignment: layout.align(),
162-
parent_idx: -1,
163-
children_start: -1,
164-
children_len: 0,
165-
}];
166-
read_layout(&mut nodes, db, &ty, &layout, 0);
167-
168-
RecursiveMemoryLayout { nodes }
169-
})
148+
ty.layout(db)
149+
.map(|layout| {
150+
let item_name = match def {
151+
Definition::Local(l) => l.name(db).as_str().unwrap().to_owned(),
152+
_ => "[ROOT]".to_owned(),
153+
};
154+
155+
let typename = ty.display(db).to_string();
156+
157+
let mut nodes = vec![MemoryLayoutNode {
158+
item_name,
159+
typename: typename.clone(),
160+
size: layout.size(),
161+
offset: 0,
162+
alignment: layout.align(),
163+
parent_idx: -1,
164+
children_start: -1,
165+
children_len: 0,
166+
}];
167+
read_layout(&mut nodes, db, &ty, &layout, 0);
168+
169+
RecursiveMemoryLayout { nodes }
170+
})
171+
.ok()
170172
}

editors/code/src/commands.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,27 +1132,24 @@ export function linkToCommand(_: Ctx): Cmd {
11321132

11331133
export function viewMemoryLayout(ctx: CtxInit): Cmd {
11341134
return async () => {
1135-
11361135
const editor = vscode.window.activeTextEditor;
11371136
if (!editor) return "";
11381137
const client = ctx.client;
11391138

11401139
const position = editor.selection.active;
11411140
const expanded = await client.sendRequest(ra.viewRecursiveMemoryLayout, {
1142-
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(
1143-
editor.document
1144-
),
1141+
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document),
11451142
position,
11461143
});
11471144

11481145
// if (expanded == null) return "Not available";
11491146

1150-
11511147
const document = vscode.window.createWebviewPanel(
11521148
"memory_layout",
11531149
"[Memory Layout]",
11541150
vscode.ViewColumn.Two,
1155-
{ enableScripts: true, });
1151+
{ enableScripts: true }
1152+
);
11561153

11571154
document.webview.html = `<!DOCTYPE html>
11581155
<html lang="en">
@@ -1407,7 +1404,7 @@ locate()
14071404
14081405
})()
14091406
</script>
1410-
</html>`
1407+
</html>`;
14111408

14121409
ctx.pushExtCleanup(document);
14131410
};

editors/code/src/lsp_ext.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>
7070

7171
export type AnalyzerStatusParams = { textDocument?: lc.TextDocumentIdentifier };
7272

73-
export interface FetchDependencyListParams { }
73+
export interface FetchDependencyListParams {}
7474

7575
export interface FetchDependencyListResult {
7676
crates: {
@@ -86,7 +86,7 @@ export const fetchDependencyList = new lc.RequestType<
8686
void
8787
>("rust-analyzer/fetchDependencyList");
8888

89-
export interface FetchDependencyGraphParams { }
89+
export interface FetchDependencyGraphParams {}
9090

9191
export interface FetchDependencyGraphResult {
9292
crates: {
@@ -150,9 +150,11 @@ export const serverStatus = new lc.NotificationType<ServerStatusParams>(
150150
"experimental/serverStatus"
151151
);
152152
export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr");
153-
export const viewRecursiveMemoryLayout = new lc.RequestType<ViewRecursiveMemoryLayoutParams, RecursiveMemoryLayout | null, void>(
154-
"rust-analyzer/viewRecursiveMemoryLayout"
155-
);
153+
export const viewRecursiveMemoryLayout = new lc.RequestType<
154+
ViewRecursiveMemoryLayoutParams,
155+
RecursiveMemoryLayout | null,
156+
void
157+
>("rust-analyzer/viewRecursiveMemoryLayout");
156158

157159
export type JoinLinesParams = {
158160
textDocument: lc.TextDocumentIdentifier;
@@ -219,4 +221,4 @@ export type RecursiveMemoryLayout = {
219221
name: string;
220222
expansion: string;
221223
nodes: RecursiveMemoryLayoutNode[];
222-
};
224+
};

editors/code/src/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export async function activate(
2424
vscode.window
2525
.showWarningMessage(
2626
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
27-
"plugins enabled. These are known to conflict and cause various functions of " +
28-
"both plugins to not work correctly. You should disable one of them.",
27+
"plugins enabled. These are known to conflict and cause various functions of " +
28+
"both plugins to not work correctly. You should disable one of them.",
2929
"Got it"
3030
)
31-
.then(() => { }, console.error);
31+
.then(() => {}, console.error);
3232
}
3333

3434
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
@@ -144,7 +144,7 @@ function createCommands(): Record<string, CommandFactory> {
144144
health: "stopped",
145145
});
146146
},
147-
disabled: (_) => async () => { },
147+
disabled: (_) => async () => {},
148148
},
149149

150150
analyzerStatus: { enabled: commands.analyzerStatus },

0 commit comments

Comments
 (0)