From 158410457f147dfb5a0c3fa84f81a5b3d0582ade Mon Sep 17 00:00:00 2001 From: delta17920 Date: Wed, 4 Feb 2026 03:35:11 +0000 Subject: [PATCH] renamed few tests --- tests/ui/borrowck/borrow-box-in-map-3026.rs | 2 + tests/ui/match/match-nested-enum-box-3121.rs | 29 +++-- .../ui/panics/vec-extend-after-panic-3029.rs | 2 + tests/ui/resolve/enum-variant-import-2904.rs | 102 +++++++++++------- .../resolve/struct-function-same-name-2708.rs | 12 +-- .../ui/structs/struct-size-with-drop-2895.rs | 4 +- .../traits/trait-object-method-call-2935.rs | 12 ++- .../ui/traits/trait-object-type-alias-3052.rs | 5 +- 8 files changed, 103 insertions(+), 65 deletions(-) diff --git a/tests/ui/borrowck/borrow-box-in-map-3026.rs b/tests/ui/borrowck/borrow-box-in-map-3026.rs index 05dc46c3cc09..dd63075eecba 100644 --- a/tests/ui/borrowck/borrow-box-in-map-3026.rs +++ b/tests/ui/borrowck/borrow-box-in-map-3026.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/3026 + //@ run-pass use std::collections::HashMap; diff --git a/tests/ui/match/match-nested-enum-box-3121.rs b/tests/ui/match/match-nested-enum-box-3121.rs index aa150f11cf40..f2ab4bf08075 100644 --- a/tests/ui/match/match-nested-enum-box-3121.rs +++ b/tests/ui/match/match-nested-enum-box-3121.rs @@ -1,21 +1,34 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/3121 + //@ run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] #[derive(Copy, Clone)] -enum side { mayo, catsup, vinegar } +enum side { + mayo, + catsup, + vinegar, +} #[derive(Copy, Clone)] -enum order { hamburger, fries(side), shake } +enum order { + hamburger, + fries(side), + shake, +} #[derive(Copy, Clone)] -enum meal { to_go(order), for_here(order) } +enum meal { + to_go(order), + for_here(order), +} fn foo(m: Box, cond: bool) { match *m { - meal::to_go(_) => { } - meal::for_here(_) if cond => {} - meal::for_here(order::hamburger) => {} - meal::for_here(order::fries(_s)) => {} - meal::for_here(order::shake) => {} + meal::to_go(_) => {} + meal::for_here(_) if cond => {} + meal::for_here(order::hamburger) => {} + meal::for_here(order::fries(_s)) => {} + meal::for_here(order::shake) => {} } } diff --git a/tests/ui/panics/vec-extend-after-panic-3029.rs b/tests/ui/panics/vec-extend-after-panic-3029.rs index 22d0906ccf70..3ae708d91e19 100644 --- a/tests/ui/panics/vec-extend-after-panic-3029.rs +++ b/tests/ui/panics/vec-extend-after-panic-3029.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/3029 + //@ run-fail //@ error-pattern:so long //@ needs-subprocess diff --git a/tests/ui/resolve/enum-variant-import-2904.rs b/tests/ui/resolve/enum-variant-import-2904.rs index 1ae3a8ad656e..3272ee5fb500 100644 --- a/tests/ui/resolve/enum-variant-import-2904.rs +++ b/tests/ui/resolve/enum-variant-import-2904.rs @@ -1,60 +1,80 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/2904 + //@ build-pass #![allow(unused_must_use)] #![allow(dead_code)] #![allow(unused_mut)] -#![allow(non_camel_case_types)] // Map representation +use Square::{Bot, ClosedLift, Earth, Empty, Lambda, OpenLift, Rock, Wall}; use std::fmt; use std::io::prelude::*; -use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; -enum square { - bot, - wall, - rock, - lambda, - closed_lift, - open_lift, - earth, - empty +enum Square { + Bot, + Wall, + Rock, + Lambda, + ClosedLift, + OpenLift, + Earth, + Empty, } -impl fmt::Debug for square { +impl fmt::Debug for Square { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", match *self { - bot => { "R".to_string() } - wall => { "#".to_string() } - rock => { "*".to_string() } - lambda => { "\\".to_string() } - closed_lift => { "L".to_string() } - open_lift => { "O".to_string() } - earth => { ".".to_string() } - empty => { " ".to_string() } - }) + write!( + f, + "{}", + match *self { + Bot => { + "R".to_string() + } + Wall => { + "#".to_string() + } + Rock => { + "*".to_string() + } + Lambda => { + "\\".to_string() + } + ClosedLift => { + "L".to_string() + } + OpenLift => { + "O".to_string() + } + Earth => { + ".".to_string() + } + Empty => { + " ".to_string() + } + } + ) } } -fn square_from_char(c: char) -> square { - match c { - 'R' => { bot } - '#' => { wall } - '*' => { rock } - '\\' => { lambda } - 'L' => { closed_lift } - 'O' => { open_lift } - '.' => { earth } - ' ' => { empty } - _ => { - println!("invalid square: {}", c); - panic!() - } +fn square_from_char(c: char) -> Square { + match c { + 'R' => Bot, + '#' => Wall, + '*' => Rock, + '\\' => Lambda, + 'L' => ClosedLift, + 'O' => OpenLift, + '.' => Earth, + ' ' => Empty, + _ => { + println!("invalid Square: {}", c); + panic!() + } } } -fn read_board_grid(mut input: rdr) - -> Vec> { +fn read_board_grid(mut input: Rdr) -> Vec> { let mut input: &mut dyn Read = &mut input; let mut grid = Vec::new(); let mut line = [0; 10]; @@ -65,14 +85,16 @@ fn read_board_grid(mut input: rdr) } grid.push(row); let width = grid[0].len(); - for row in &grid { assert_eq!(row.len(), width) } + for row in &grid { + assert_eq!(row.len(), width) + } grid } mod test { #[test] pub fn trivial_to_string() { - assert_eq!(lambda.to_string(), "\\") + assert_eq!(Lambda.to_string(), "\\") } } diff --git a/tests/ui/resolve/struct-function-same-name-2708.rs b/tests/ui/resolve/struct-function-same-name-2708.rs index 09d19f87aa64..729a5819ae4e 100644 --- a/tests/ui/resolve/struct-function-same-name-2708.rs +++ b/tests/ui/resolve/struct-function-same-name-2708.rs @@ -1,15 +1,13 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/2708 + //@ run-pass #![allow(dead_code)] #![allow(non_snake_case)] - - - struct Font { fontbuf: usize, cairo_font: usize, font_dtor: usize, - } impl Drop for Font { @@ -17,11 +15,7 @@ impl Drop for Font { } fn Font() -> Font { - Font { - fontbuf: 0, - cairo_font: 0, - font_dtor: 0 - } + Font { fontbuf: 0, cairo_font: 0, font_dtor: 0 } } pub fn main() { diff --git a/tests/ui/structs/struct-size-with-drop-2895.rs b/tests/ui/structs/struct-size-with-drop-2895.rs index 6301a8637534..9540d340ff68 100644 --- a/tests/ui/structs/struct-size-with-drop-2895.rs +++ b/tests/ui/structs/struct-size-with-drop-2895.rs @@ -1,10 +1,12 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/2895 + //@ run-pass #![allow(dead_code)] use std::mem; struct Cat { - x: isize + x: isize, } struct Kitty { diff --git a/tests/ui/traits/trait-object-method-call-2935.rs b/tests/ui/traits/trait-object-method-call-2935.rs index bcc25f6187b5..ea24aae89462 100644 --- a/tests/ui/traits/trait-object-method-call-2935.rs +++ b/tests/ui/traits/trait-object-method-call-2935.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/2935 + //@ run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] @@ -11,14 +13,14 @@ trait it { } impl it for t { - fn f(&self) { } + fn f(&self) {} } pub fn main() { - // let x = ({a: 4} as it); - // let y = box ({a: 4}); - // let z = box ({a: 4} as it); - // let z = box ({a: true} as it); + // let x = ({a: 4} as it); + // let y = box ({a: 4}); + // let z = box ({a: 4} as it); + // let z = box ({a: true} as it); let z: Box<_> = Box::new(Box::new(true) as Box); // x.f(); // y.f(); diff --git a/tests/ui/traits/trait-object-type-alias-3052.rs b/tests/ui/traits/trait-object-type-alias-3052.rs index ab3519fe7147..e601c76713dc 100644 --- a/tests/ui/traits/trait-object-type-alias-3052.rs +++ b/tests/ui/traits/trait-object-type-alias-3052.rs @@ -1,3 +1,5 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/3052 + //@ run-pass #![allow(dead_code)] @@ -8,5 +10,4 @@ fn f() -> Option { Some(mock_connection) } -pub fn main() { -} +pub fn main() {}