mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 11:03:16 +00:00
0fe6003dff
The crates.io page of clippy still suggest to install `clippy-preview` instead of `clippy` I think it's time to change this. Thanks to the Stuttgart Meetup for discovering this!
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
extern crate term;
|
|
|
|
fn main() {
|
|
if let Err(_) = foo() {
|
|
eprintln!("error: Clippy is no longer available via crates.io\n");
|
|
eprintln!("help: please run `rustup component add clippy` instead");
|
|
}
|
|
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(|_| ())?;
|
|
write!(t, "rustup component add clippy").map_err(|_| ())?;
|
|
|
|
t.reset().map_err(|_| ())?;
|
|
t.fg(term::color::WHITE).map_err(|_| ())?;
|
|
writeln!(t, "` instead").map_err(|_| ())?;
|
|
|
|
t.reset().map_err(|_| ())?;
|
|
Ok(())
|
|
}
|