Run tidy on tests

This commit is contained in:
Ryan Lowe 2024-04-28 18:04:25 -04:00
parent ed9d6e0c03
commit 419924d878
7 changed files with 45 additions and 28 deletions

View File

@ -6,7 +6,7 @@ fn test_clone<T: Clone>(arg: T) {
let _ = arg.clone(); let _ = arg.clone();
} }
fn foo() { } fn foo() {}
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
struct S(i32); struct S(i32);
@ -27,19 +27,7 @@ fn builtin_clone() {
let b = [S(1), S(2), S(3)]; let b = [S(1), S(2), S(3)];
assert_eq!(b, a.clone()); assert_eq!(b, a.clone());
let a = ( let a = ((S(1), S(0)), ((S(0), S(0), S(1)), S(0)));
(S(1), S(0)), let b = ((S(2), S(1)), ((S(1), S(1), S(2)), S(1)));
(
(S(0), S(0), S(1)),
S(0)
)
);
let b = (
(S(2), S(1)),
(
(S(1), S(1), S(2)),
S(1)
)
);
assert_eq!(b, a.clone()); assert_eq!(b, a.clone());
} }

View File

@ -7,13 +7,35 @@ struct Foo;
#[derive(Debug)] #[derive(Debug)]
struct Fu; struct Fu;
impl PartialEq for Baz { fn eq(&self, _: &Baz) -> bool { true } } impl PartialEq for Baz {
fn eq(&self, _: &Baz) -> bool {
true
}
}
impl PartialEq<Fu> for Foo { fn eq(&self, _: &Fu) -> bool { true } } impl PartialEq<Fu> for Foo {
impl PartialEq<Foo> for Fu { fn eq(&self, _: &Foo) -> bool { true } } fn eq(&self, _: &Fu) -> bool {
true
}
}
impl PartialEq<Bar> for Foo { fn eq(&self, _: &Bar) -> bool { false } } impl PartialEq<Foo> for Fu {
impl PartialEq<Foo> for Bar { fn eq(&self, _: &Foo) -> bool { false } } fn eq(&self, _: &Foo) -> bool {
true
}
}
impl PartialEq<Bar> for Foo {
fn eq(&self, _: &Bar) -> bool {
false
}
}
impl PartialEq<Foo> for Bar {
fn eq(&self, _: &Foo) -> bool {
false
}
}
#[test] #[test]
fn eq_multidispatch() { fn eq_multidispatch() {

View File

@ -3,7 +3,11 @@
use std::fmt::Debug; use std::fmt::Debug;
struct NT(str); struct NT(str);
struct DST { a: u32, b: str }
struct DST {
a: u32,
b: str,
}
macro_rules! check { macro_rules! check {
(val: $ty_of:expr, $expected:expr) => { (val: $ty_of:expr, $expected:expr) => {
@ -56,7 +60,9 @@ fn type_name_of_val<T>(_: T) -> &'static str {
struct Foo; struct Foo;
impl Foo { impl Foo {
fn new() -> Self { Foo } fn new() -> Self {
Foo
}
} }
fn foo() -> impl Debug { fn foo() -> impl Debug {

View File

@ -9,7 +9,9 @@ fn test_stack_assign() {
} }
#[test] #[test]
fn test_heap_lit() { "a big string".to_string(); } fn test_heap_lit() {
"a big string".to_string();
}
#[test] #[test]
fn test_heap_assign() { fn test_heap_assign() {

View File

@ -3,8 +3,8 @@
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
enum foo { enum foo {
a(usize), a(usize),
b(String), b(String),
} }
fn check_log<T: std::fmt::Debug>(exp: String, v: T) { fn check_log<T: std::fmt::Debug>(exp: String, v: T) {

View File

@ -1,10 +1,10 @@
use std::fmt::Debug;
use std::cmp::{self, Ordering}; use std::cmp::{self, Ordering};
use std::fmt::Debug;
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Foo { struct Foo {
n: u8, n: u8,
name: &'static str name: &'static str,
} }
impl PartialOrd for Foo { impl PartialOrd for Foo {

View File

@ -3862,7 +3862,6 @@ ui/statics/issue-91050-1.rs
ui/statics/issue-91050-2.rs ui/statics/issue-91050-2.rs
ui/std/issue-3563-3.rs ui/std/issue-3563-3.rs
ui/std/issue-81357-unsound-file-methods.rs ui/std/issue-81357-unsound-file-methods.rs
ui/stdlib-unit-tests/issue-21058.rs
ui/structs-enums/enum-rec/issue-17431-6.rs ui/structs-enums/enum-rec/issue-17431-6.rs
ui/structs-enums/enum-rec/issue-17431-7.rs ui/structs-enums/enum-rec/issue-17431-7.rs
ui/structs-enums/issue-103869.rs ui/structs-enums/issue-103869.rs