-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3247 from rust-lang-nursery/dummy
Add dummy clippy crate for publishing
- Loading branch information
Showing
6 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "clippy_dummy" # rename to clippy before publishing | ||
version = "0.0.301" | ||
authors = ["Manish Goregaokar <[email protected]>"] | ||
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-nursery/rust-clippy" | ||
|
||
license = "MPL-2.0" | ||
keywords = ["clippy", "lint", "plugin"] | ||
categories = ["development-tools", "development-tools::cargo-plugins"] | ||
|
||
[build-dependencies] | ||
term = "0.5.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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-preview` 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-preview").map_err(|_| ())?; | ||
|
||
t.reset().map_err(|_| ())?; | ||
t.fg(term::color::WHITE).map_err(|_| ())?; | ||
writeln!(t, "` instead").map_err(|_| ())?; | ||
|
||
t.reset().map_err(|_| ())?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Installing clippy via crates.io is deprecated. Please use the following: | ||
|
||
```terminal | ||
rustup component add clippy-preview | ||
``` | ||
|
||
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-nursery/rust-clippy/#clippy) for more information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
panic!("This shouldn't even compile") | ||
} |