Skip to content

Commit 8aaf187

Browse files
committed
Add rustfmt to the tools list
1 parent ab75525 commit 8aaf187

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rustup-cli/self_update.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,16 @@ Studio 2013 and during install select the "C++ tools":
184184
185185
_Install the C++ build tools before proceeding_.
186186
187-
If you will be targetting the GNU ABI or otherwise know what you are
187+
If you will be targeting the GNU ABI or otherwise know what you are
188188
doing then it is fine to continue installation without the build
189189
tools, but otherwise, install the C++ build tools before proceeding.
190190
"#;
191191

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

195+
static DUP_TOOLS: &'static [&'static str] = &["rustfmt", "cargo-fmt"];
196+
195197
static UPDATE_ROOT: &'static str
196198
= "https://static.rust-lang.org/rustup";
197199

@@ -652,6 +654,18 @@ fn install_bins() -> Result<()> {
652654
let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX));
653655
try!(utils::hard_or_symlink_file(rustup_path, tool_path));
654656
}
657+
for tool in DUP_TOOLS {
658+
let ref token_path = bin_path.join(&format!("{}.rustup", tool));
659+
let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX));
660+
if tool_path.exists() && !token_path.exists() {
661+
warn!("tool `{}` is already installed, remove it from `{}`, then run `rustup update` \
662+
to have rustup manage this tool.",
663+
tool, bin_path.to_string_lossy());
664+
} else {
665+
try!(utils::hard_or_symlink_file(rustup_path, tool_path));
666+
try!(utils::write_file("<token file>", token_path, ""));
667+
}
668+
}
655669

656670
Ok(())
657671
}
@@ -752,7 +766,7 @@ pub fn uninstall(no_prompt: bool) -> Result<()> {
752766

753767
// Then everything in bin except rustup and tools. These can't be unlinked
754768
// until this process exits (on windows).
755-
let tools = TOOLS.iter().map(|t| format!("{}{}", t, EXE_SUFFIX));
769+
let tools = TOOLS.iter().chain(DUP_TOOLS.iter()).map(|t| format!("{}{}", t, EXE_SUFFIX));
756770
let tools: Vec<_> = tools.chain(vec![format!("rustup{}", EXE_SUFFIX)]).collect();
757771
for dirent in try!(fs::read_dir(&cargo_home.join("bin")).chain_err(|| read_dir_err)) {
758772
let dirent = try!(dirent.chain_err(|| read_dir_err));

src/rustup-win-installer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const LOGMSG_STANDARD: i32 = 2;
1616

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

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

0 commit comments

Comments
 (0)