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