Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Dec 21, 2024
1 parent 5609c12 commit 636926b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/state/fixup.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use rustc_ast::Expr;
use rustc_ast::util::{classify, parser};

// The default amount of fixing is minimal fixing. Fixups should be turned on
// in a targeted fashion where needed.
// The default amount of fixing is minimal fixing, so all fixups are set to `false` by `Default`.
// Fixups should be turned on in a targeted fashion where needed.
#[derive(Copy, Clone, Debug, Default)]
pub(crate) struct FixupContext {
/// Print expression such that it can be parsed back as a statement
Expand Down
1 change: 1 addition & 0 deletions library/core/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ macro_rules! default_impl {
default_impl! { (), (), "Returns the default value of `()`" }
default_impl! { bool, false, "Returns the default value of `false`" }
default_impl! { char, '\x00', "Returns the default value of `\\x00`" }
default_impl! { AsciiChar, AsciiChar::Null, "Returns the default value of `Null`" }

default_impl! { usize, 0, "Returns the default value of `0`" }
default_impl! { u8, 0, "Returns the default value of `0`" }
Expand Down
16 changes: 12 additions & 4 deletions src/tools/rustfmt/src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,9 @@ pub enum ReportTactic {

/// What Rustfmt should emit. Mostly corresponds to the `--emit` command line
/// option.
#[derive(Default)]
#[config_type]
pub enum EmitMode {
/// Emits to files.
#[default]
Files,
/// Writes the output to stdout.
Stdout,
Expand Down Expand Up @@ -312,6 +310,12 @@ impl ::std::str::FromStr for WidthHeuristics {
}
}

impl Default for EmitMode {
fn default() -> EmitMode {
EmitMode::Files
}
}

/// A set of directories, files and modules that rustfmt should ignore.
#[derive(Default, Clone, Debug, PartialEq)]
pub struct IgnoreList {
Expand Down Expand Up @@ -421,12 +425,10 @@ pub trait CliOptions {
}

/// The edition of the syntax and semantics of code (RFC 2052).
#[derive(Default)]
#[config_type]
pub enum Edition {
#[value = "2015"]
#[doc_hint = "2015"]
#[default]
/// Edition 2015.
Edition2015,
#[value = "2018"]
Expand All @@ -443,6 +445,12 @@ pub enum Edition {
Edition2024,
}

impl Default for Edition {
fn default() -> Edition {
Edition::Edition2015
}
}

impl From<Edition> for rustc_span::edition::Edition {
fn from(edition: Edition) -> Self {
match edition {
Expand Down

0 comments on commit 636926b

Please sign in to comment.