Skip to content

Commit

Permalink
Fix test error in rust-lang/rust#125533
Browse files Browse the repository at this point in the history
As lint dropping_copy_types will give suggsetion in this
situation.(Changed in rust-lang/rust#125433)
  • Loading branch information
surechen committed May 25, 2024
1 parent a8d72c6 commit 1c8da38
Showing 1 changed file with 12 additions and 12 deletions.
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

0 comments on commit 1c8da38

Please sign in to comment.