summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/clippy_dummy
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/clippy_dummy/Cargo.toml16
-rw-r--r--src/tools/clippy/clippy_dummy/PUBLISH.md6
-rw-r--r--src/tools/clippy/clippy_dummy/build.rs42
-rw-r--r--src/tools/clippy/clippy_dummy/crates-readme.md9
-rw-r--r--src/tools/clippy/clippy_dummy/src/main.rs3
5 files changed, 76 insertions, 0 deletions
diff --git a/src/tools/clippy/clippy_dummy/Cargo.toml b/src/tools/clippy/clippy_dummy/Cargo.toml
new file mode 100644
index 000000000..c206a1eb0
--- /dev/null
+++ b/src/tools/clippy/clippy_dummy/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "clippy_dummy" # rename to clippy before publishing
+version = "0.0.303"
+edition = "2018"
+readme = "crates-readme.md"
+description = "A bunch of helpful lints to avoid common pitfalls in Rust."
+build = 'build.rs'
+
+repository = "https://github.com/rust-lang/rust-clippy"
+
+license = "MIT OR Apache-2.0"
+keywords = ["clippy", "lint", "plugin"]
+categories = ["development-tools", "development-tools::cargo-plugins"]
+
+[build-dependencies]
+term = "0.7"
diff --git a/src/tools/clippy/clippy_dummy/PUBLISH.md b/src/tools/clippy/clippy_dummy/PUBLISH.md
new file mode 100644
index 000000000..8e420ec95
--- /dev/null
+++ b/src/tools/clippy/clippy_dummy/PUBLISH.md
@@ -0,0 +1,6 @@
+This is a dummy crate to publish to crates.io. It primarily exists to ensure
+that folks trying to install clippy from crates.io get redirected to the
+`rustup` technique.
+
+Before publishing, be sure to rename `clippy_dummy` to `clippy` in `Cargo.toml`,
+it has a different name to avoid workspace issues.
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(())
+}
diff --git a/src/tools/clippy/clippy_dummy/crates-readme.md b/src/tools/clippy/clippy_dummy/crates-readme.md
new file mode 100644
index 000000000..0decae8b9
--- /dev/null
+++ b/src/tools/clippy/clippy_dummy/crates-readme.md
@@ -0,0 +1,9 @@
+Installing clippy via crates.io is deprecated. Please use the following:
+
+```terminal
+rustup component add clippy
+```
+
+on a Rust version 1.29 or later. You may need to run `rustup self update` if it complains about a missing clippy binary.
+
+See [the homepage](https://github.com/rust-lang/rust-clippy/#clippy) for more information
diff --git a/src/tools/clippy/clippy_dummy/src/main.rs b/src/tools/clippy/clippy_dummy/src/main.rs
new file mode 100644
index 000000000..a118834f1
--- /dev/null
+++ b/src/tools/clippy/clippy_dummy/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ panic!("This shouldn't even compile")
+}