Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: switch from drop to let _ due to nightly rustc change #13964

Merged
merged 1 commit into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn do_not_fix_broken_builds() {
r#"
pub fn foo() {
let mut x = 3;
drop(x);
let _ = x;
}

pub fn foo2() {
Expand Down Expand Up @@ -427,7 +427,7 @@ fn fix_deny_warnings() {
.file(
"src/lib.rs",
"#![deny(warnings)]
pub fn foo() { let mut x = 3; drop(x); }
pub fn foo() { let mut x = 3; let _ = x; }
",
)
.build();
Expand Down Expand Up @@ -503,25 +503,25 @@ fn fix_two_files() {
#[cargo_test]
fn fixes_missing_ampersand() {
let p = project()
.file("src/main.rs", "fn main() { let mut x = 3; drop(x); }")
.file("src/main.rs", "fn main() { let mut x = 3; let _ = x; }")
.file(
"src/lib.rs",
r#"
pub fn foo() { let mut x = 3; drop(x); }
pub fn foo() { let mut x = 3; let _ = x; }

#[test]
pub fn foo2() { let mut x = 3; drop(x); }
pub fn foo2() { let mut x = 3; let _ = x; }
"#,
)
.file(
"tests/a.rs",
r#"
#[test]
pub fn foo() { let mut x = 3; drop(x); }
pub fn foo() { let mut x = 3; let _ = x; }
"#,
)
.file("examples/foo.rs", "fn main() { let mut x = 3; drop(x); }")
.file("build.rs", "fn main() { let mut x = 3; drop(x); }")
.file("examples/foo.rs", "fn main() { let mut x = 3; let _ = x; }")
.file("build.rs", "fn main() { let mut x = 3; let _ = x; }")
.build();

p.cargo("fix --all-targets --allow-no-vcs")
Expand Down Expand Up @@ -701,8 +701,8 @@ fn does_not_warn_about_dirty_ignored_files() {
#[cargo_test]
fn fix_all_targets_by_default() {
let p = project()
.file("src/lib.rs", "pub fn foo() { let mut x = 3; drop(x); }")
.file("tests/foo.rs", "pub fn foo() { let mut x = 3; drop(x); }")
.file("src/lib.rs", "pub fn foo() { let mut x = 3; let _ = x; }")
.file("tests/foo.rs", "pub fn foo() { let mut x = 3; let _ = x; }")
.build();
p.cargo("fix --allow-no-vcs")
.env("__CARGO_FIX_YOLO", "1")
Expand Down Expand Up @@ -1280,7 +1280,7 @@ fn fix_to_broken_code() {
"#,
)
.file("bar/build.rs", "fn main() {}")
.file("bar/src/lib.rs", "pub fn foo() { let mut x = 3; drop(x); }")
.file("bar/src/lib.rs", "pub fn foo() { let mut x = 3; let _ = x; }")
.build();

// Build our rustc shim
Expand All @@ -1296,7 +1296,7 @@ fn fix_to_broken_code() {

assert_eq!(
p.read_file("bar/src/lib.rs"),
"pub fn foo() { let x = 3; drop(x); }"
"pub fn foo() { let x = 3; let _ = x; }"
);
}

Expand Down