Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,19 @@ fn show_channel_updates(
match result {
Ok(UpdateStatus::Installed) => {
banner = "installed";
color = Some(term2::color::BRIGHT_GREEN);
color = Some(term2::color::GREEN);
}
Ok(UpdateStatus::Updated) => {
banner = "updated";
color = Some(term2::color::BRIGHT_GREEN);
color = Some(term2::color::GREEN);
}
Ok(UpdateStatus::Unchanged) => {
banner = "unchanged";
color = None;
}
Err(_) => {
banner = "update failed";
color = Some(term2::color::BRIGHT_RED);
color = Some(term2::color::RED);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/cli/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro_rules! debug {

pub fn warn_fmt(args: fmt::Arguments<'_>) {
let mut t = term2::stderr();
let _ = t.fg(term2::color::BRIGHT_YELLOW);
let _ = t.fg(term2::color::YELLOW);
let _ = t.attr(term2::Attr::Bold);
let _ = write!(t, "warning: ");
let _ = t.reset();
Expand All @@ -33,7 +33,7 @@ pub fn warn_fmt(args: fmt::Arguments<'_>) {

pub fn err_fmt(args: fmt::Arguments<'_>) {
let mut t = term2::stderr();
let _ = t.fg(term2::color::BRIGHT_RED);
let _ = t.fg(term2::color::RED);
let _ = t.attr(term2::Attr::Bold);
let _ = write!(t, "error: ");
let _ = t.reset();
Expand All @@ -52,7 +52,7 @@ pub fn info_fmt(args: fmt::Arguments<'_>) {

pub fn verbose_fmt(args: fmt::Arguments<'_>) {
let mut t = term2::stderr();
let _ = t.fg(term2::color::BRIGHT_MAGENTA);
let _ = t.fg(term2::color::MAGENTA);
let _ = t.attr(term2::Attr::Bold);
let _ = write!(t, "verbose: ");
let _ = t.reset();
Expand All @@ -63,7 +63,7 @@ pub fn verbose_fmt(args: fmt::Arguments<'_>) {
pub fn debug_fmt(args: fmt::Arguments<'_>) {
if std::env::var("RUSTUP_DEBUG").is_ok() {
let mut t = term2::stderr();
let _ = t.fg(term2::color::BRIGHT_BLUE);
let _ = t.fg(term2::color::BLUE);
let _ = t.attr(term2::Attr::Bold);
let _ = write!(t, "verbose: ");
let _ = t.reset();
Expand Down
2 changes: 1 addition & 1 deletion src/cli/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'a, T: Terminal + io::Write + 'a> LineFormatter<'a, T> {
self.wrapper.write_line();
}
Tag::Emphasis => {
self.push_attr(Attr::ForegroundColor(color::BRIGHT_RED));
self.push_attr(Attr::ForegroundColor(color::RED));
}
Tag::Strong => {}
Tag::Strikethrough => {}
Expand Down
8 changes: 4 additions & 4 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,23 +766,23 @@ fn check_updates(cfg: &Cfg) -> Result<()> {
write!(t, "{} - ", name)?;
match (current_version, dist_version) {
(None, None) => {
let _ = t.fg(term2::color::BRIGHT_RED);
let _ = t.fg(term2::color::RED);
writeln!(t, "Cannot identify installed or update versions")?;
}
(Some(cv), None) => {
let _ = t.fg(term2::color::BRIGHT_GREEN);
let _ = t.fg(term2::color::GREEN);
write!(t, "Up to date")?;
let _ = t.reset();
writeln!(t, " : {}", cv)?;
}
(Some(cv), Some(dv)) => {
let _ = t.fg(term2::color::BRIGHT_YELLOW);
let _ = t.fg(term2::color::YELLOW);
write!(t, "Update available")?;
let _ = t.reset();
writeln!(t, " : {} -> {}", cv, dv)?;
}
(None, Some(dv)) => {
let _ = t.fg(term2::color::BRIGHT_YELLOW);
let _ = t.fg(term2::color::YELLOW);
write!(t, "Update available")?;
let _ = t.reset();
writeln!(t, " : (Unknown version) -> {}", dv)?;
Expand Down
12 changes: 1 addition & 11 deletions src/cli/term2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,7 @@ where
if !T::isatty() {
return Ok(());
}

if let Err(e) = self.0.attr(attr) {
// If `attr` is not supported, try to emulate it
match attr {
Attr::Bold => swallow_unsupported!(self.0.fg(color::BRIGHT_WHITE)),
_ => swallow_unsupported!(Err(e)),
}
} else {
Ok(())
}
swallow_unsupported!(self.0.attr(attr))
}

fn supports_attr(&self, attr: Attr) -> bool {
Expand All @@ -198,7 +189,6 @@ where
if !T::isatty() {
return Ok(());
}

swallow_unsupported!(self.0.cursor_up())
}

Expand Down