Skip to content

Commit c16381d

Browse files
committed
style: Make clippy happy
1 parent ba228ff commit c16381d

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

crates/libtest-lexarg/src/lib.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,51 +42,36 @@ pub struct TestOpts {
4242
}
4343

4444
/// Whether ignored test should be run or not (see [`TestOpts::run_ignored`])
45-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
45+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
4646
pub enum RunIgnored {
4747
Yes,
48+
#[default]
4849
No,
4950
/// Run only ignored tests
5051
Only,
5152
}
5253

53-
impl Default for RunIgnored {
54-
fn default() -> Self {
55-
Self::No
56-
}
57-
}
58-
5954
/// Whether should console output be colored or not (see [`TestOpts::color`])
60-
#[derive(Copy, Clone, Debug)]
55+
#[derive(Copy, Clone, Debug, Default)]
6156
pub enum ColorConfig {
57+
#[default]
6258
AutoColor,
6359
AlwaysColor,
6460
NeverColor,
6561
}
6662

67-
impl Default for ColorConfig {
68-
fn default() -> Self {
69-
Self::AutoColor
70-
}
71-
}
72-
7363
/// Format of the test results output (see [`TestOpts::format`])
74-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
64+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
7565
pub enum OutputFormat {
7666
/// Verbose output
67+
#[default]
7768
Pretty,
7869
/// Quiet output
7970
Terse,
8071
/// JSON output
8172
Json,
8273
}
8374

84-
impl Default for OutputFormat {
85-
fn default() -> Self {
86-
Self::Pretty
87-
}
88-
}
89-
9075
pub const UNSTABLE_OPTIONS: &str = "unstable-options";
9176

9277
pub const OPTIONS_HELP: &str = r#"

crates/libtest2-harness/src/case.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait Case: Send + Sync + 'static {
1717

1818
/// Type of the test according to the [rust book](https://doc.rust-lang.org/cargo/guide/tests.html)
1919
/// conventions.
20-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
20+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)]
2121
pub enum TestKind {
2222
/// Unit-tests are expected to be in the `src` folder of the crate.
2323
UnitTest,
@@ -27,15 +27,10 @@ pub enum TestKind {
2727
DocTest,
2828
/// Tests for the sources that don't follow the project layout convention
2929
/// (e.g. tests in raw `main.rs` compiled by calling `rustc --test` directly).
30+
#[default]
3031
Unknown,
3132
}
3233

33-
impl Default for TestKind {
34-
fn default() -> Self {
35-
Self::Unknown
36-
}
37-
}
38-
3934
#[derive(Debug)]
4035
#[non_exhaustive]
4136
pub enum Source {

0 commit comments

Comments
 (0)