Skip to content

Commit

Permalink
Run tidy on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rytheo committed Apr 28, 2024
1 parent ed9d6e0 commit 419924d
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 28 deletions.
18 changes: 3 additions & 15 deletions library/std/tests/builtin-clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn test_clone<T: Clone>(arg: T) {
let _ = arg.clone();
}

fn foo() { }
fn foo() {}

#[derive(Debug, PartialEq, Eq)]
struct S(i32);
Expand All @@ -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());
}
32 changes: 27 additions & 5 deletions library/std/tests/eq-multidispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fu> for Foo {
fn eq(&self, _: &Fu) -> bool {
true
}
}

impl PartialEq<Fu> for Foo { fn eq(&self, _: &Fu) -> bool { true } }
impl PartialEq<Foo> for Fu { fn eq(&self, _: &Foo) -> bool { true } }
impl PartialEq<Foo> for Fu {
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 } }
impl PartialEq<Bar> for Foo {
fn eq(&self, _: &Bar) -> bool {
false
}
}

impl PartialEq<Foo> for Bar {
fn eq(&self, _: &Foo) -> bool {
false
}
}

#[test]
fn eq_multidispatch() {
Expand Down
10 changes: 8 additions & 2 deletions library/std/tests/issue-21058.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -56,7 +60,9 @@ fn type_name_of_val<T>(_: T) -> &'static str {
struct Foo;

impl Foo {
fn new() -> Self { Foo }
fn new() -> Self {
Foo
}
}

fn foo() -> impl Debug {
Expand Down
4 changes: 3 additions & 1 deletion library/std/tests/istr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions library/std/tests/log-knows-the-names-of-variants-in-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#[derive(Clone, Debug)]
enum foo {
a(usize),
b(String),
a(usize),
b(String),
}

fn check_log<T: std::fmt::Debug>(exp: String, v: T) {
Expand Down
4 changes: 2 additions & 2 deletions library/std/tests/minmax-stability-issue-23687.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 419924d

Please sign in to comment.