Skip to content

Commit

Permalink
Add rustfmt to the tools list
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Nov 29, 2017
1 parent ab75525 commit 8aaf187
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions src/rustup-cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,16 @@ Studio 2013 and during install select the "C++ tools":
_Install the C++ build tools before proceeding_.
If you will be targetting the GNU ABI or otherwise know what you are
If you will be targeting the GNU ABI or otherwise know what you are
doing then it is fine to continue installation without the build
tools, but otherwise, install the C++ build tools before proceeding.
"#;

static TOOLS: &'static [&'static str]
= &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls"];

static DUP_TOOLS: &'static [&'static str] = &["rustfmt", "cargo-fmt"];

static UPDATE_ROOT: &'static str
= "https://static.rust-lang.org/rustup";

Expand Down Expand Up @@ -652,6 +654,18 @@ fn install_bins() -> Result<()> {
let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX));
try!(utils::hard_or_symlink_file(rustup_path, tool_path));
}
for tool in DUP_TOOLS {
let ref token_path = bin_path.join(&format!("{}.rustup", tool));
let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX));
if tool_path.exists() && !token_path.exists() {
warn!("tool `{}` is already installed, remove it from `{}`, then run `rustup update` \
to have rustup manage this tool.",
tool, bin_path.to_string_lossy());
} else {
try!(utils::hard_or_symlink_file(rustup_path, tool_path));
try!(utils::write_file("<token file>", token_path, ""));
}
}

Ok(())
}
Expand Down Expand Up @@ -752,7 +766,7 @@ pub fn uninstall(no_prompt: bool) -> Result<()> {

// Then everything in bin except rustup and tools. These can't be unlinked
// until this process exits (on windows).
let tools = TOOLS.iter().map(|t| format!("{}{}", t, EXE_SUFFIX));
let tools = TOOLS.iter().chain(DUP_TOOLS.iter()).map(|t| format!("{}{}", t, EXE_SUFFIX));
let tools: Vec<_> = tools.chain(vec![format!("rustup{}", EXE_SUFFIX)]).collect();
for dirent in try!(fs::read_dir(&cargo_home.join("bin")).chain_err(|| read_dir_err)) {
let dirent = try!(dirent.chain_err(|| read_dir_err));
Expand Down
2 changes: 1 addition & 1 deletion src/rustup-win-installer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const LOGMSG_STANDARD: i32 = 2;

// TODO: share this with self_update.rs
static TOOLS: &'static [&'static str]
= &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls"];
= &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls", "rustfmt", "cargo-fmt"];

#[no_mangle]
/// This is be run as a `deferred` action after `InstallFiles` on install and upgrade
Expand Down

0 comments on commit 8aaf187

Please sign in to comment.