From fc57339fdf2566a7e149918a37d31ffd6c664e7b Mon Sep 17 00:00:00 2001 From: Bruno Ortiz Date: Sun, 2 Apr 2023 22:06:15 -0300 Subject: [PATCH] removing unused code --- editors/code/src/toolchain.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index 2d23e8c35e..8c2e55bcc2 100644 --- a/editors/code/src/toolchain.ts +++ b/editors/code/src/toolchain.ts @@ -3,9 +3,7 @@ import * as os from "os"; import * as path from "path"; import * as readline from "readline"; import * as vscode from "vscode"; -import { execute, log, memoizeAsync } from "./util"; - -const TOOLCHAIN_PATTERN = new RegExp(/(.*)\s\(.*\)/); +import {execute, log, memoizeAsync} from "./util"; interface CompilationArtifact { fileName: string; @@ -24,7 +22,7 @@ export class Cargo { readonly rootFolder: string, readonly output: vscode.OutputChannel, readonly env: Record - ) { } + ) {} // Made public for testing purposes static artifactSpec(args: readonly string[]): ArtifactSpec { @@ -44,7 +42,7 @@ export class Cargo { } } - const result: ArtifactSpec = { cargoArgs: cargoArgs }; + const result: ArtifactSpec = {cargoArgs: cargoArgs}; if (cargoArgs[0] === "test" || cargoArgs[0] === "bench") { // for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests // produce 2 artifacts: {"kind": "bin"} and {"kind": "test"} @@ -149,7 +147,7 @@ export class Cargo { cargo.stderr.on("data", (chunk) => onStderrString(chunk.toString())); - const rl = readline.createInterface({ input: cargo.stdout }); + const rl = readline.createInterface({input: cargo.stdout}); rl.on("line", (line) => { const message = JSON.parse(line); onStdoutJson(message); @@ -191,14 +189,14 @@ export async function getSysroot(dir: string): Promise { const rustcPath = await getPathForExecutable("rustc"); // do not memoize the result because the toolchain may change between runs - return await execute(`${rustcPath} --print sysroot`, { cwd: dir }); + return await execute(`${rustcPath} --print sysroot`, {cwd: dir}); } export async function getRustcId(dir: string): Promise { const rustcPath = await getPathForExecutable("rustc"); // do not memoize the result because the toolchain may change between runs - const data = await execute(`${rustcPath} -V -v`, { cwd: dir }); + const data = await execute(`${rustcPath} -V -v`, {cwd: dir}); const rx = /commit-hash:\s(.*)$/m; return rx.exec(data)![1]; @@ -219,11 +217,6 @@ export function cargoPath(): Promise { return getPathForExecutable("cargo"); } -/** Mirrors `toolchain::cargo()` implementation */ -export function rustupPath(): Promise { - return getPathForExecutable("rustup"); -} - /** Mirrors `toolchain::get_path_for_executable()` implementation */ export const getPathForExecutable = memoizeAsync( // We apply caching to decrease file-system interactions