From 419924d878ee9aeef6e73236ee693f1457c662f1 Mon Sep 17 00:00:00 2001 From: Ryan Lowe Date: Sun, 28 Apr 2024 18:04:25 -0400 Subject: [PATCH] Run tidy on tests --- library/std/tests/builtin-clone.rs | 18 ++--------- library/std/tests/eq-multidispatch.rs | 32 ++++++++++++++++--- library/std/tests/issue-21058.rs | 10 ++++-- library/std/tests/istr.rs | 4 ++- .../log-knows-the-names-of-variants-in-std.rs | 4 +-- .../std/tests/minmax-stability-issue-23687.rs | 4 +-- src/tools/tidy/src/issues.txt | 1 - 7 files changed, 45 insertions(+), 28 deletions(-) diff --git a/library/std/tests/builtin-clone.rs b/library/std/tests/builtin-clone.rs index c5b3f4ebc12..66b57130c95 100644 --- a/library/std/tests/builtin-clone.rs +++ b/library/std/tests/builtin-clone.rs @@ -6,7 +6,7 @@ fn test_clone(arg: T) { let _ = arg.clone(); } -fn foo() { } +fn foo() {} #[derive(Debug, PartialEq, Eq)] struct S(i32); @@ -27,19 +27,7 @@ fn builtin_clone() { let b = [S(1), S(2), S(3)]; assert_eq!(b, a.clone()); - let a = ( - (S(1), S(0)), - ( - (S(0), S(0), S(1)), - S(0) - ) - ); - let b = ( - (S(2), S(1)), - ( - (S(1), S(1), S(2)), - S(1) - ) - ); + let a = ((S(1), S(0)), ((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()); } diff --git a/library/std/tests/eq-multidispatch.rs b/library/std/tests/eq-multidispatch.rs index 6c98fa6a1bd..96e440f85e0 100644 --- a/library/std/tests/eq-multidispatch.rs +++ b/library/std/tests/eq-multidispatch.rs @@ -7,13 +7,35 @@ struct Foo; #[derive(Debug)] struct Fu; -impl PartialEq for Baz { fn eq(&self, _: &Baz) -> bool { true } } +impl PartialEq for Baz { + fn eq(&self, _: &Baz) -> bool { + true + } +} -impl PartialEq for Foo { fn eq(&self, _: &Fu) -> bool { true } } -impl PartialEq for Fu { fn eq(&self, _: &Foo) -> bool { true } } +impl PartialEq for Foo { + fn eq(&self, _: &Fu) -> bool { + true + } +} -impl PartialEq for Foo { fn eq(&self, _: &Bar) -> bool { false } } -impl PartialEq for Bar { fn eq(&self, _: &Foo) -> bool { false } } +impl PartialEq for Fu { + fn eq(&self, _: &Foo) -> bool { + true + } +} + +impl PartialEq for Foo { + fn eq(&self, _: &Bar) -> bool { + false + } +} + +impl PartialEq for Bar { + fn eq(&self, _: &Foo) -> bool { + false + } +} #[test] fn eq_multidispatch() { diff --git a/library/std/tests/issue-21058.rs b/library/std/tests/issue-21058.rs index 0626c870d81..3d9f2639593 100644 --- a/library/std/tests/issue-21058.rs +++ b/library/std/tests/issue-21058.rs @@ -3,7 +3,11 @@ use std::fmt::Debug; struct NT(str); -struct DST { a: u32, b: str } + +struct DST { + a: u32, + b: str, +} macro_rules! check { (val: $ty_of:expr, $expected:expr) => { @@ -56,7 +60,9 @@ fn type_name_of_val(_: T) -> &'static str { struct Foo; impl Foo { - fn new() -> Self { Foo } + fn new() -> Self { + Foo + } } fn foo() -> impl Debug { diff --git a/library/std/tests/istr.rs b/library/std/tests/istr.rs index b27eaf8f890..9a127ae803e 100644 --- a/library/std/tests/istr.rs +++ b/library/std/tests/istr.rs @@ -9,7 +9,9 @@ fn test_stack_assign() { } #[test] -fn test_heap_lit() { "a big string".to_string(); } +fn test_heap_lit() { + "a big string".to_string(); +} #[test] fn test_heap_assign() { diff --git a/library/std/tests/log-knows-the-names-of-variants-in-std.rs b/library/std/tests/log-knows-the-names-of-variants-in-std.rs index 82afc8b219e..118bee62018 100644 --- a/library/std/tests/log-knows-the-names-of-variants-in-std.rs +++ b/library/std/tests/log-knows-the-names-of-variants-in-std.rs @@ -3,8 +3,8 @@ #[derive(Clone, Debug)] enum foo { - a(usize), - b(String), + a(usize), + b(String), } fn check_log(exp: String, v: T) { diff --git a/library/std/tests/minmax-stability-issue-23687.rs b/library/std/tests/minmax-stability-issue-23687.rs index dcc36826f21..119c520de8f 100644 --- a/library/std/tests/minmax-stability-issue-23687.rs +++ b/library/std/tests/minmax-stability-issue-23687.rs @@ -1,10 +1,10 @@ -use std::fmt::Debug; use std::cmp::{self, Ordering}; +use std::fmt::Debug; #[derive(Debug, Copy, Clone, PartialEq, Eq)] struct Foo { n: u8, - name: &'static str + name: &'static str, } impl PartialOrd for Foo { diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 4f02a61f7bc..a931782e8cc 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -3862,7 +3862,6 @@ ui/statics/issue-91050-1.rs ui/statics/issue-91050-2.rs ui/std/issue-3563-3.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-7.rs ui/structs-enums/issue-103869.rs