Open
Conversation
471fb49 to
2bbc0fd
Compare
Emilgardis
commented
Mar 25, 2023
Comment on lines
-94
to
+151
| l.replace(" (default)", "") | ||
| .replace(" (override)", "") | ||
| .trim() | ||
| .to_owned() | ||
| let mut mode = ToolchainMode::None; | ||
| let mut l = if l.contains(" (override)") { | ||
| mode = ToolchainMode::Override; | ||
| l.replace(" (override)", "") | ||
| } else { | ||
| l.to_owned() | ||
| }; | ||
| if l.contains(" (default)") { | ||
| if mode.is_overriden() { | ||
| mode = ToolchainMode::DefaultOverride; | ||
| } else { | ||
| mode = ToolchainMode::Default; | ||
| } | ||
| l = l.replace(" (default)", ""); | ||
| } | ||
|
|
||
| (l, mode) | ||
| }) |
Member
Author
There was a problem hiding this comment.
I'm not super happy about this.
Comment on lines
+124
to
+126
| pub fn installed_toolchains( | ||
| msg_info: &mut MessageInfo, | ||
| ) -> Result<Vec<(String, ToolchainMode, std::path::PathBuf)>> { |
Member
Author
There was a problem hiding this comment.
should probably return a vec of struct, like available_targets
Comment on lines
-367
to
-375
| pub fn sysroot(msg_info: &mut MessageInfo) -> Result<PathBuf> { | ||
| let stdout = rustc_command() | ||
| .args(["--print", "sysroot"]) | ||
| .run_and_get_stdout(msg_info)? | ||
| .trim() | ||
| .to_owned(); | ||
| Ok(PathBuf::from(stdout)) | ||
| } | ||
|
|
Member
Author
There was a problem hiding this comment.
this is not needed anymore, rustup toolchain list -v gives us this, for all toolchains
Comment on lines
+204
to
+217
| let (toolchain_name, sysroot) = if let Some((toolchain_name, _, sysroot)) = | ||
| installed_toolchains | ||
| .iter() | ||
| .find(|(_, mode, _)| mode.is_overriden()) | ||
| { | ||
| (toolchain_name, sysroot) | ||
| } else if let Some((toolchain_name, _, sysroot)) = installed_toolchains | ||
| .iter() | ||
| .find(|(_, mode, _)| mode.is_defaulted()) | ||
| { | ||
| (toolchain_name, sysroot) | ||
| } else { | ||
| eyre::bail!("no default toolchain found"); | ||
| }; |
Member
Author
There was a problem hiding this comment.
I feel like there is a better way to write this, not sure how though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves #1198