Skip to content

Commit 09e4fa9

Browse files
committed
Use derive(Default) in rustfmt
1 parent ddbdbc0 commit 09e4fa9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Diff for: src/tools/rustfmt/src/config/options.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ pub enum ReportTactic {
155155

156156
/// What Rustfmt should emit. Mostly corresponds to the `--emit` command line
157157
/// option.
158+
#[derive(Default)]
158159
#[config_type]
159160
pub enum EmitMode {
160161
/// Emits to files.
162+
#[default]
161163
Files,
162164
/// Writes the output to stdout.
163165
Stdout,
@@ -310,12 +312,6 @@ impl ::std::str::FromStr for WidthHeuristics {
310312
}
311313
}
312314

313-
impl Default for EmitMode {
314-
fn default() -> EmitMode {
315-
EmitMode::Files
316-
}
317-
}
318-
319315
/// A set of directories, files and modules that rustfmt should ignore.
320316
#[derive(Default, Clone, Debug, PartialEq)]
321317
pub struct IgnoreList {
@@ -425,10 +421,12 @@ pub trait CliOptions {
425421
}
426422

427423
/// The edition of the syntax and semantics of code (RFC 2052).
424+
#[derive(Default)]
428425
#[config_type]
429426
pub enum Edition {
430427
#[value = "2015"]
431428
#[doc_hint = "2015"]
429+
#[default]
432430
/// Edition 2015.
433431
Edition2015,
434432
#[value = "2018"]
@@ -445,12 +443,6 @@ pub enum Edition {
445443
Edition2024,
446444
}
447445

448-
impl Default for Edition {
449-
fn default() -> Edition {
450-
Edition::Edition2015
451-
}
452-
}
453-
454446
impl From<Edition> for rustc_span::edition::Edition {
455447
fn from(edition: Edition) -> Self {
456448
match edition {

0 commit comments

Comments
 (0)