Skip to content

Commit d277c84

Browse files
committed
No longer warn about #![feature(rust_2018_preview)]
This is no longer needed, and so the warning is outdated. Fixes #6050
1 parent feb2209 commit d277c84

File tree

2 files changed

+0
-56
lines changed

2 files changed

+0
-56
lines changed

src/cargo/ops/fix.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@ fn rustfix_crate(lock_addr: &str, rustc: &Path, filename: &Path, args: &FixArgs)
233233
-> Result<FixedCrate, Error>
234234
{
235235
args.verify_not_preparing_for_enabled_edition()?;
236-
args.warn_if_preparing_probably_inert()?;
237236

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

599-
/// If we're preparing for an edition and we *don't* find the
600-
/// `rust_2018_preview` feature, for example, in the entry point file then
601-
/// it probably means that the edition isn't actually enabled, so we can't
602-
/// actually fix anything.
603-
///
604-
/// If this is the case, issue a warning.
605-
fn warn_if_preparing_probably_inert(&self) -> CargoResult<()> {
606-
let edition = match self.prepare_for_edition_resolve() {
607-
Some(s) => s,
608-
None => return Ok(()),
609-
};
610-
let path = match &self.file {
611-
Some(s) => s,
612-
None => return Ok(()),
613-
};
614-
let contents = match fs::read_to_string(path) {
615-
Ok(s) => s,
616-
Err(_) => return Ok(())
617-
};
618-
619-
let feature_name = format!("rust_{}_preview", edition);
620-
if contents.contains(&feature_name) {
621-
return Ok(())
622-
}
623-
Message::PreviewNotFound {
624-
file: path.display().to_string(),
625-
edition: edition.to_string(),
626-
}.post()?;
627-
628-
Ok(())
629-
}
630-
631598
fn prepare_for_edition_resolve(&self) -> Option<&str> {
632599
match &self.prepare_for_edition {
633600
PrepareFor::Edition(s) => Some(s),

tests/testsuite/fix.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,6 @@ fn local_paths_no_fix() {
335335

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

856-
#[test]
857-
fn prepare_for_without_feature_issues_warning() {
858-
if !is_nightly() {
859-
return;
860-
}
861-
let p = project().file("src/lib.rs", "").build();
862-
863-
let stderr = "\
864-
[CHECKING] foo v0.0.1 ([..])
865-
warning: failed to find `#![feature(rust_2018_preview)]` in `src/lib.rs`
866-
this may cause `cargo fix` to not be able to fix all
867-
issues in preparation for the 2018 edition
868-
[FINISHED] [..]
869-
";
870-
p.cargo("fix --edition --allow-no-vcs")
871-
.masquerade_as_nightly_cargo()
872-
.with_stderr(stderr)
873-
.run();
874-
}
875-
876853
#[test]
877854
fn fix_overlapping() {
878855
if !is_nightly() {

0 commit comments

Comments
 (0)