rust/clippy_dummy/build.rs

43 lines
876 B
Rust
Raw Normal View History

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