mirror of
https://github.com/rust-lang/cargo
synced 2024-10-06 15:59:39 +00:00
Remove --cap-lints feature detection (fix issue #3828)
This commit is contained in:
parent
62eb9dddeb
commit
e45a25012b
|
@ -253,20 +253,12 @@ fn rustc(cx: &mut Context, unit: &Unit, exec: Arc<Executor>) -> CargoResult<Work
|
|||
// If this is an upstream dep we don't want warnings from, turn off all
|
||||
// lints.
|
||||
if !cx.show_warnings(unit.pkg.package_id()) {
|
||||
if cx.config.rustc()?.cap_lints {
|
||||
rustc.arg("--cap-lints").arg("allow");
|
||||
} else {
|
||||
rustc.arg("-Awarnings");
|
||||
}
|
||||
rustc.arg("--cap-lints").arg("allow");
|
||||
|
||||
// If this is an upstream dep but we *do* want warnings, make sure that they
|
||||
// don't fail compilation.
|
||||
} else if !unit.pkg.package_id().source_id().is_path() {
|
||||
if cx.config.rustc()?.cap_lints {
|
||||
rustc.arg("--cap-lints").arg("warn");
|
||||
} else {
|
||||
rustc.arg("-Awarnings"); // not much to do on older compilers
|
||||
}
|
||||
rustc.arg("--cap-lints").arg("warn");
|
||||
}
|
||||
|
||||
let filenames = cx.target_filenames(unit)?;
|
||||
|
|
|
@ -6,8 +6,6 @@ pub struct Rustc {
|
|||
pub path: PathBuf,
|
||||
pub verbose_version: String,
|
||||
pub host: String,
|
||||
/// Backwards compatibility: does this compiler support `--cap-lints` flag?
|
||||
pub cap_lints: bool,
|
||||
}
|
||||
|
||||
impl Rustc {
|
||||
|
@ -19,15 +17,9 @@ impl Rustc {
|
|||
pub fn new(path: PathBuf) -> CargoResult<Rustc> {
|
||||
let mut cmd = util::process(&path);
|
||||
cmd.arg("-vV");
|
||||
|
||||
let mut first = cmd.clone();
|
||||
first.arg("--cap-lints").arg("allow");
|
||||
|
||||
let (cap_lints, output) = match first.exec_with_output() {
|
||||
Ok(output) => (true, output),
|
||||
Err(..) => (false, cmd.exec_with_output()?),
|
||||
};
|
||||
|
||||
|
||||
let output = cmd.exec_with_output()?;
|
||||
|
||||
let verbose_version = String::from_utf8(output.stdout).map_err(|_| {
|
||||
internal("rustc -v didn't return utf8 output")
|
||||
})?;
|
||||
|
@ -46,7 +38,6 @@ impl Rustc {
|
|||
path: path,
|
||||
verbose_version: verbose_version,
|
||||
host: host,
|
||||
cap_lints: cap_lints,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::io::prelude::*;
|
|||
use std::path::Path;
|
||||
|
||||
use cargo::util::process;
|
||||
use cargotest::{sleep_ms, RUSTC};
|
||||
use cargotest::sleep_ms;
|
||||
use cargotest::support::paths::{self, CargoPathExt};
|
||||
use cargotest::support::{git, project, execs, main_file, path2url};
|
||||
use hamcrest::{assert_that,existing_file};
|
||||
|
@ -1743,9 +1743,6 @@ fn lints_are_suppressed() {
|
|||
|
||||
#[test]
|
||||
fn denied_lints_are_allowed() {
|
||||
let enabled = RUSTC.with(|r| r.cap_lints);
|
||||
if !enabled { return }
|
||||
|
||||
let a = git::new("a", |p| {
|
||||
p.file("Cargo.toml", r#"
|
||||
[project]
|
||||
|
|
Loading…
Reference in a new issue