diff options
| author | Jake Goulding <jake.goulding@gmail.com> | 2025-05-29 09:38:44 -0400 |
|---|---|---|
| committer | Jake Goulding <jake.goulding@gmail.com> | 2025-06-06 08:30:47 -0400 |
| commit | 8fc1bed0c8b6aab76d07e7576b0c1c1f29b934bf (patch) | |
| tree | 4012f1755ccaf77ba1cf6019922ff82f185509f2 /tests | |
| parent | d00435f223dc3a88d8c5f472b10ba948b7959cc6 (diff) | |
| download | rust-8fc1bed0c8b6aab76d07e7576b0c1c1f29b934bf.tar.gz rust-8fc1bed0c8b6aab76d07e7576b0c1c1f29b934bf.zip | |
Reduce confusion of some drop order tests
In addition to adhering to normal Rust casing idioms, I ran `rustfmt`.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/drop/issue-2735-2.rs | 13 | ||||
| -rw-r--r-- | tests/ui/drop/issue-2735-3.rs | 11 | ||||
| -rw-r--r-- | tests/ui/drop/issue-2735.rs | 12 | ||||
| -rw-r--r-- | tests/ui/drop/issue-979.rs | 11 |
4 files changed, 18 insertions, 29 deletions
diff --git a/tests/ui/drop/issue-2735-2.rs b/tests/ui/drop/issue-2735-2.rs index 66025956e08..43fbafe7a0e 100644 --- a/tests/ui/drop/issue-2735-2.rs +++ b/tests/ui/drop/issue-2735-2.rs @@ -1,27 +1,24 @@ //@ run-pass -#![allow(non_camel_case_types)] use std::cell::Cell; // This test should behave exactly like issue-2735-3 -struct defer<'a> { +struct Defer<'a> { b: &'a Cell<bool>, } -impl<'a> Drop for defer<'a> { +impl<'a> Drop for Defer<'a> { fn drop(&mut self) { self.b.set(true); } } -fn defer(b: &Cell<bool>) -> defer<'_> { - defer { - b: b - } +fn defer(b: &Cell<bool>) -> Defer<'_> { + Defer { b } } pub fn main() { let dtor_ran = &Cell::new(false); - let _ = defer(dtor_ran); + let _ = defer(dtor_ran); assert!(dtor_ran.get()); } diff --git a/tests/ui/drop/issue-2735-3.rs b/tests/ui/drop/issue-2735-3.rs index c9535168653..cc28f96d2b0 100644 --- a/tests/ui/drop/issue-2735-3.rs +++ b/tests/ui/drop/issue-2735-3.rs @@ -1,23 +1,20 @@ //@ run-pass -#![allow(non_camel_case_types)] use std::cell::Cell; // This test should behave exactly like issue-2735-2 -struct defer<'a> { +struct Defer<'a> { b: &'a Cell<bool>, } -impl<'a> Drop for defer<'a> { +impl<'a> Drop for Defer<'a> { fn drop(&mut self) { self.b.set(true); } } -fn defer(b: &Cell<bool>) -> defer<'_> { - defer { - b: b - } +fn defer(b: &Cell<bool>) -> Defer<'_> { + Defer { b } } pub fn main() { diff --git a/tests/ui/drop/issue-2735.rs b/tests/ui/drop/issue-2735.rs index cd7e0b8f461..838b9da109b 100644 --- a/tests/ui/drop/issue-2735.rs +++ b/tests/ui/drop/issue-2735.rs @@ -1,15 +1,13 @@ //@ run-pass #![allow(dead_code)] -#![allow(non_camel_case_types)] - -trait hax { - fn dummy(&self) { } +trait Hax { + fn dummy(&self) {} } -impl<A> hax for A { } +impl<A> Hax for A {} -fn perform_hax<T: 'static>(x: Box<T>) -> Box<dyn hax+'static> { - Box::new(x) as Box<dyn hax+'static> +fn perform_hax<T: 'static>(x: Box<T>) -> Box<dyn Hax + 'static> { + Box::new(x) as Box<dyn Hax + 'static> } fn deadcode() { diff --git a/tests/ui/drop/issue-979.rs b/tests/ui/drop/issue-979.rs index 70052708be6..abbcc71de18 100644 --- a/tests/ui/drop/issue-979.rs +++ b/tests/ui/drop/issue-979.rs @@ -1,22 +1,19 @@ //@ run-pass -#![allow(non_camel_case_types)] use std::cell::Cell; -struct r<'a> { +struct R<'a> { b: &'a Cell<isize>, } -impl<'a> Drop for r<'a> { +impl<'a> Drop for R<'a> { fn drop(&mut self) { self.b.set(self.b.get() + 1); } } -fn r(b: &Cell<isize>) -> r<'_> { - r { - b: b - } +fn r(b: &Cell<isize>) -> R<'_> { + R { b } } pub fn main() { |
