1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
14 if let Err(_) = foo() {
15 eprintln!("error: Clippy is no longer available via crates.io\n");
16 eprintln!("help: please run `rustup component add clippy-preview` instead");
18 std::process::exit(1);
21 fn foo() -> Result<(), ()> {
22 let mut t = term::stderr().ok_or(())?;
24 t.attr(term::Attr::Bold).map_err(|_| ())?;
25 t.fg(term::color::RED).map_err(|_| ())?;
26 write!(t, "\nerror: ").map_err(|_| ())?;
29 t.reset().map_err(|_| ())?;
30 t.fg(term::color::WHITE).map_err(|_| ())?;
31 writeln!(t, "Clippy is no longer available via crates.io\n").map_err(|_| ())?;
34 t.attr(term::Attr::Bold).map_err(|_| ())?;
35 t.fg(term::color::GREEN).map_err(|_| ())?;
36 write!(t, "help: ").map_err(|_| ())?;
39 t.reset().map_err(|_| ())?;
40 t.fg(term::color::WHITE).map_err(|_| ())?;
41 write!(t, "please run `").map_err(|_| ())?;
43 t.attr(term::Attr::Bold).map_err(|_| ())?;
44 write!(t, "rustup component add clippy-preview").map_err(|_| ())?;
46 t.reset().map_err(|_| ())?;
47 t.fg(term::color::WHITE).map_err(|_| ())?;
48 writeln!(t, "` instead").map_err(|_| ())?;
50 t.reset().map_err(|_| ())?;