Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Commit b42c0e8

Browse filesBrowse files
raggiKalitaAlexey
authored andcommitted
rustup: if the user only has one toolchain, use it (#340)
This fixes one common use case of #339, but not all. If the user only has one toolchain, and it's a nightly, just use that instead of doing the configuration prompt dance.
1 parent b03b857 commit b42c0e8
Copy full SHA for b42c0e8

File tree

1 file changed

+10
-3
lines changed
Filter options

1 file changed

+10
-3
lines changed

‎src/components/configuration/Rustup.ts

Copy file name to clipboardExpand all lines: src/components/configuration/Rustup.ts
+10-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ export class Rustup {
110110
* Returns either the nightly toolchain chosen by the user or undefined
111111
*/
112112
public getUserNightlyToolchain(): Toolchain | undefined {
113-
return this._userNightlyToolchain;
113+
if (this._userNightlyToolchain) {
114+
return this._userNightlyToolchain;
115+
}
116+
const defaultToolchain = this.getDefaultToolchain();
117+
if (defaultToolchain && defaultToolchain.channel === 'nightly') {
118+
return defaultToolchain;
119+
}
120+
return undefined;
114121
}
115122

116123
/**
@@ -128,10 +135,10 @@ export class Rustup {
128135
}
129136

130137
/**
131-
* Returns either the toolchain chosen by the user or undefined
138+
* Returns either the toolchain chosen by the user or the default or undefined
132139
*/
133140
public getUserToolchain(): Toolchain | undefined {
134-
return this._userToolchain;
141+
return this._userToolchain || this.getDefaultToolchain();
135142
}
136143

137144
public setUserToolchain(toolchain: Toolchain | undefined): void {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.