2019-12-22 21:49:59 +00:00
|
|
|
use term::color::{GREEN, RED, WHITE};
|
|
|
|
use term::{Attr, Error, Result};
|
2018-10-01 20:03:07 +00:00
|
|
|
|
|
|
|
fn main() {
|
2019-12-22 21:49:59 +00:00
|
|
|
if foo().is_err() {
|
|
|
|
eprintln!(
|
|
|
|
"error: Clippy is no longer available via crates.io\n\n\
|
|
|
|
help: please run `rustup component add clippy` instead"
|
|
|
|
);
|
2018-10-01 20:03:07 +00:00
|
|
|
}
|
|
|
|
std::process::exit(1);
|
|
|
|
}
|
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
fn foo() -> Result<()> {
|
|
|
|
let mut t = term::stderr().ok_or(Error::NotSupported)?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.attr(Attr::Bold)?;
|
|
|
|
t.fg(RED)?;
|
|
|
|
write!(t, "\nerror: ")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.reset()?;
|
|
|
|
t.fg(WHITE)?;
|
|
|
|
writeln!(t, "Clippy is no longer available via crates.io\n")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.attr(Attr::Bold)?;
|
|
|
|
t.fg(GREEN)?;
|
|
|
|
write!(t, "help: ")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.reset()?;
|
|
|
|
t.fg(WHITE)?;
|
|
|
|
write!(t, "please run `")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.attr(Attr::Bold)?;
|
|
|
|
write!(t, "rustup component add clippy")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.reset()?;
|
|
|
|
t.fg(WHITE)?;
|
|
|
|
writeln!(t, "` instead")?;
|
2018-10-01 20:03:07 +00:00
|
|
|
|
2019-12-22 21:49:59 +00:00
|
|
|
t.reset()?;
|
2018-10-01 20:03:07 +00:00
|
|
|
Ok(())
|
2019-01-07 21:33:18 +00:00
|
|
|
}
|