Skip to content

Commit f309967

Browse files
authored
Merge pull request #1640 from dwijnand/use-empty-println
Use println!() over println!("")
2 parents e83464f + b74e052 commit f309967

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/rustup-cli/common.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn confirm(question: &str, default: bool) -> Result<bool> {
2727
_ => false,
2828
};
2929

30-
println!("");
30+
println!();
3131

3232
Ok(r)
3333
}
@@ -39,7 +39,7 @@ pub enum Confirm {
3939
}
4040

4141
pub fn confirm_advanced() -> Result<Confirm> {
42-
println!("");
42+
println!();
4343
println!("1) Proceed with installation (default)");
4444
println!("2) Customize installation");
4545
println!("3) Cancel installation");
@@ -54,7 +54,7 @@ pub fn confirm_advanced() -> Result<Confirm> {
5454
_ => Confirm::No,
5555
};
5656

57-
println!("");
57+
println!();
5858

5959
Ok(r)
6060
}
@@ -64,7 +64,7 @@ pub fn question_str(question: &str, default: &str) -> Result<String> {
6464
let _ = std::io::stdout().flush();
6565
let input = read_line()?;
6666

67-
println!("");
67+
println!();
6868

6969
if input.is_empty() {
7070
Ok(default.to_string())
@@ -79,7 +79,7 @@ pub fn question_bool(question: &str, default: bool) -> Result<bool> {
7979
let _ = std::io::stdout().flush();
8080
let input = read_line()?;
8181

82-
println!("");
82+
println!();
8383

8484
if input.is_empty() {
8585
Ok(default)
@@ -208,7 +208,7 @@ pub fn update_all_channels(cfg: &Cfg, do_self_update: bool, force_update: bool)
208208

209209
let show_channel_updates = || {
210210
if !toolchains.is_empty() {
211-
println!("");
211+
println!();
212212

213213
show_channel_updates(cfg, toolchains)?;
214214
}
@@ -383,7 +383,7 @@ pub fn list_overrides(cfg: &Cfg) -> Result<()> {
383383
)
384384
}
385385
if any_not_exist {
386-
println!("");
386+
println!();
387387
info!(
388388
"you may remove overrides for non-existent directories with
389389
`rustup override unset --nonexistent`"
@@ -410,7 +410,7 @@ pub fn report_error(e: &Error) {
410410
if show_backtrace() {
411411
if let Some(backtrace) = e.backtrace() {
412412
info!("backtrace:");
413-
println!("");
413+
println!();
414414
println!("{:?}", backtrace);
415415
}
416416
} else {

src/rustup-cli/rustup_mode.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ fn update_bare_triple_check(cfg: &Cfg, name: &str) -> Result<()> {
537537
for n in &candidates {
538538
println!("{}", n);
539539
}
540-
println!("");
540+
println!();
541541
}
542542
}
543543
return Err(ErrorKind::ToolchainNotInstalled(name.to_string()).into());
@@ -587,7 +587,7 @@ fn default_(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
587587
toolchain.make_default()?;
588588

589589
if let Some(status) = status {
590-
println!("");
590+
println!();
591591
common::show_channel_update(cfg, toolchain.name(), Ok(status))?;
592592
}
593593

@@ -610,7 +610,7 @@ fn update(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
610610
};
611611

612612
if let Some(status) = status {
613-
println!("");
613+
println!();
614614
common::show_channel_update(cfg, toolchain.name(), Ok(status))?;
615615
}
616616
}
@@ -657,7 +657,7 @@ fn show(cfg: &Cfg) -> Result<()> {
657657
let _ = write!(t, "Default host: ");
658658
let _ = t.reset();
659659
println!("{}", cfg.get_default_host_triple()?);
660-
println!("");
660+
println!();
661661
}
662662

663663
let ref cwd = utils::current_dir()?;
@@ -710,7 +710,7 @@ fn show(cfg: &Cfg) -> Result<()> {
710710
}
711711
}
712712
if show_headers {
713-
println!("")
713+
println!()
714714
};
715715
}
716716

@@ -728,7 +728,7 @@ fn show(cfg: &Cfg) -> Result<()> {
728728
);
729729
}
730730
if show_headers {
731-
println!("")
731+
println!()
732732
};
733733
}
734734

@@ -761,7 +761,7 @@ fn show(cfg: &Cfg) -> Result<()> {
761761
}
762762

763763
if show_headers {
764-
println!("")
764+
println!()
765765
};
766766
}
767767

@@ -911,7 +911,7 @@ fn override_add(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
911911
toolchain.make_override(&utils::current_dir()?)?;
912912

913913
if let Some(status) = status {
914-
println!("");
914+
println!();
915915
common::show_channel_update(cfg, toolchain.name(), Ok(status))?;
916916
}
917917

src/rustup-cli/self_update.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn install(no_prompt: bool, verbose: bool, mut opts: InstallOpts) -> Result<
290290
// the user an opportunity to see the error before the
291291
// window closes.
292292
if cfg!(windows) && !no_prompt {
293-
println!("");
293+
println!();
294294
println!("Press the Enter key to continue.");
295295
common::read_line()?;
296296
}
@@ -325,7 +325,7 @@ pub fn install(no_prompt: bool, verbose: bool, mut opts: InstallOpts) -> Result<
325325
// that may have opened just for this purpose, require
326326
// the user to press a key to continue.
327327
if cfg!(windows) {
328-
println!("");
328+
println!();
329329
println!("Press the Enter key to continue.");
330330
common::read_line()?;
331331
}
@@ -650,7 +650,7 @@ fn customize_install(mut opts: InstallOpts) -> Result<InstallOpts> {
650650
You may simply press the Enter key to leave unchanged."
651651
);
652652

653-
println!("");
653+
println!();
654654

655655
opts.default_host_triple =
656656
common::question_str("Default host triple?", &opts.default_host_triple)?;
@@ -800,18 +800,18 @@ fn maybe_install_rust(toolchain_str: &str, default_host_triple: &str, verbose: b
800800
// possible to select a toolchain then have it not be installed.
801801
if toolchain_str == "none" {
802802
info!("skipping toolchain installation");
803-
println!("");
803+
println!();
804804
} else if cfg.find_default()?.is_none() {
805805
// Set host triple first as it will affect resolution of toolchain_str
806806
cfg.set_default_host_triple(default_host_triple)?;
807807
let toolchain = cfg.get_toolchain(toolchain_str, false)?;
808808
let status = toolchain.install_from_dist(false)?;
809809
cfg.set_default(toolchain_str)?;
810-
println!("");
810+
println!();
811811
common::show_channel_update(cfg, toolchain_str, Ok(status))?;
812812
} else {
813813
info!("updating existing rustup installation");
814-
println!("");
814+
println!();
815815
}
816816

817817
Ok(())
@@ -846,7 +846,7 @@ pub fn uninstall(no_prompt: bool) -> Result<()> {
846846
}
847847

848848
if !no_prompt {
849-
println!("");
849+
println!();
850850
let ref msg = format!(pre_uninstall_msg!(), cargo_home = canonical_cargo_home()?);
851851
term2::stdout().md(msg);
852852
if !common::confirm("\nContinue? (y/N)", false)? {

0 commit comments

Comments
 (0)