From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/clippy_dummy/build.rs | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/tools/clippy/clippy_dummy/build.rs (limited to 'src/tools/clippy/clippy_dummy/build.rs') diff --git a/src/tools/clippy/clippy_dummy/build.rs b/src/tools/clippy/clippy_dummy/build.rs new file mode 100644 index 000000000..21af4f824 --- /dev/null +++ b/src/tools/clippy/clippy_dummy/build.rs @@ -0,0 +1,42 @@ +use term::color::{GREEN, RED, WHITE}; +use term::{Attr, Error, Result}; + +fn main() { + if foo().is_err() { + eprintln!( + "error: Clippy is no longer available via crates.io\n\n\ + help: please run `rustup component add clippy` instead" + ); + } + std::process::exit(1); +} + +fn foo() -> Result<()> { + let mut t = term::stderr().ok_or(Error::NotSupported)?; + + t.attr(Attr::Bold)?; + t.fg(RED)?; + write!(t, "\nerror: ")?; + + t.reset()?; + t.fg(WHITE)?; + writeln!(t, "Clippy is no longer available via crates.io\n")?; + + t.attr(Attr::Bold)?; + t.fg(GREEN)?; + write!(t, "help: ")?; + + t.reset()?; + t.fg(WHITE)?; + write!(t, "please run `")?; + + t.attr(Attr::Bold)?; + write!(t, "rustup component add clippy")?; + + t.reset()?; + t.fg(WHITE)?; + writeln!(t, "` instead")?; + + t.reset()?; + Ok(()) +} -- cgit v1.2.3