Skip to content

Commit

Permalink
No longer warn about #![feature(rust_2018_preview)]
Browse files Browse the repository at this point in the history
This is no longer needed, and so the warning is outdated.

Fixes rust-lang#6050
  • Loading branch information
steveklabnik committed Sep 18, 2018
1 parent b917e35 commit f27fcf9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
33 changes: 0 additions & 33 deletions src/cargo/ops/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ fn rustfix_crate(lock_addr: &str, rustc: &Path, filename: &Path, args: &FixArgs)
-> Result<FixedCrate, Error>
{
args.verify_not_preparing_for_enabled_edition()?;
args.warn_if_preparing_probably_inert()?;

// First up we want to make sure that each crate is only checked by one
// process at a time. If two invocations concurrently check a crate then
Expand Down Expand Up @@ -596,38 +595,6 @@ impl FixArgs {
process::exit(1);
}

/// If we're preparing for an edition and we *don't* find the
/// `rust_2018_preview` feature, for example, in the entry point file then
/// it probably means that the edition isn't actually enabled, so we can't
/// actually fix anything.
///
/// If this is the case, issue a warning.
fn warn_if_preparing_probably_inert(&self) -> CargoResult<()> {
let edition = match self.prepare_for_edition_resolve() {
Some(s) => s,
None => return Ok(()),
};
let path = match &self.file {
Some(s) => s,
None => return Ok(()),
};
let contents = match fs::read_to_string(path) {
Ok(s) => s,
Err(_) => return Ok(())
};

let feature_name = format!("rust_{}_preview", edition);
if contents.contains(&feature_name) {
return Ok(())
}
Message::PreviewNotFound {
file: path.display().to_string(),
edition: edition.to_string(),
}.post()?;

Ok(())
}

fn prepare_for_edition_resolve(&self) -> Option<&str> {
match &self.prepare_for_edition {
PrepareFor::Edition(s) => Some(s),
Expand Down
23 changes: 0 additions & 23 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ fn local_paths_no_fix() {

let stderr = "\
[CHECKING] foo v0.0.1 ([..])
warning: failed to find `#![feature(rust_2018_preview)]` in `src/lib.rs`
this may cause `cargo fix` to not be able to fix all
issues in preparation for the 2018 edition
[FINISHED] [..]
";
p.cargo("fix --edition --allow-no-vcs")
Expand Down Expand Up @@ -853,26 +850,6 @@ information about transitioning to the 2018 edition see:
.run();
}

#[test]
fn prepare_for_without_feature_issues_warning() {
if !is_nightly() {
return;
}
let p = project().file("src/lib.rs", "").build();

let stderr = "\
[CHECKING] foo v0.0.1 ([..])
warning: failed to find `#![feature(rust_2018_preview)]` in `src/lib.rs`
this may cause `cargo fix` to not be able to fix all
issues in preparation for the 2018 edition
[FINISHED] [..]
";
p.cargo("fix --edition --allow-no-vcs")
.masquerade_as_nightly_cargo()
.with_stderr(stderr)
.run();
}

#[test]
fn fix_overlapping() {
if !is_nightly() {
Expand Down

0 comments on commit f27fcf9

Please sign in to comment.