@@ -3,9 +3,7 @@ import * as os from "os";
3
3
import * as path from "path" ;
4
4
import * as readline from "readline" ;
5
5
import * as vscode from "vscode" ;
6
- import { execute , log , memoizeAsync } from "./util" ;
7
-
8
- const TOOLCHAIN_PATTERN = new RegExp ( / ( .* ) \s \( .* \) / ) ;
6
+ import { execute , log , memoizeAsync } from "./util" ;
9
7
10
8
interface CompilationArtifact {
11
9
fileName : string ;
@@ -24,7 +22,7 @@ export class Cargo {
24
22
readonly rootFolder : string ,
25
23
readonly output : vscode . OutputChannel ,
26
24
readonly env : Record < string , string >
27
- ) { }
25
+ ) { }
28
26
29
27
// Made public for testing purposes
30
28
static artifactSpec ( args : readonly string [ ] ) : ArtifactSpec {
@@ -44,7 +42,7 @@ export class Cargo {
44
42
}
45
43
}
46
44
47
- const result : ArtifactSpec = { cargoArgs : cargoArgs } ;
45
+ const result : ArtifactSpec = { cargoArgs : cargoArgs } ;
48
46
if ( cargoArgs [ 0 ] === "test" || cargoArgs [ 0 ] === "bench" ) {
49
47
// for instance, `crates\rust-analyzer\tests\heavy_tests\main.rs` tests
50
48
// produce 2 artifacts: {"kind": "bin"} and {"kind": "test"}
@@ -149,7 +147,7 @@ export class Cargo {
149
147
150
148
cargo . stderr . on ( "data" , ( chunk ) => onStderrString ( chunk . toString ( ) ) ) ;
151
149
152
- const rl = readline . createInterface ( { input : cargo . stdout } ) ;
150
+ const rl = readline . createInterface ( { input : cargo . stdout } ) ;
153
151
rl . on ( "line" , ( line ) => {
154
152
const message = JSON . parse ( line ) ;
155
153
onStdoutJson ( message ) ;
@@ -191,14 +189,14 @@ export async function getSysroot(dir: string): Promise<string> {
191
189
const rustcPath = await getPathForExecutable ( "rustc" ) ;
192
190
193
191
// do not memoize the result because the toolchain may change between runs
194
- return await execute ( `${ rustcPath } --print sysroot` , { cwd : dir } ) ;
192
+ return await execute ( `${ rustcPath } --print sysroot` , { cwd : dir } ) ;
195
193
}
196
194
197
195
export async function getRustcId ( dir : string ) : Promise < string > {
198
196
const rustcPath = await getPathForExecutable ( "rustc" ) ;
199
197
200
198
// do not memoize the result because the toolchain may change between runs
201
- const data = await execute ( `${ rustcPath } -V -v` , { cwd : dir } ) ;
199
+ const data = await execute ( `${ rustcPath } -V -v` , { cwd : dir } ) ;
202
200
const rx = / c o m m i t - h a s h : \s ( .* ) $ / m;
203
201
204
202
return rx . exec ( data ) ! [ 1 ] ;
@@ -219,11 +217,6 @@ export function cargoPath(): Promise<string> {
219
217
return getPathForExecutable ( "cargo" ) ;
220
218
}
221
219
222
- /** Mirrors `toolchain::cargo()` implementation */
223
- export function rustupPath ( ) : Promise < string > {
224
- return getPathForExecutable ( "rustup" ) ;
225
- }
226
-
227
220
/** Mirrors `toolchain::get_path_for_executable()` implementation */
228
221
export const getPathForExecutable = memoizeAsync (
229
222
// We apply caching to decrease file-system interactions
0 commit comments