Skip to content

Commit 636926b

Browse files
committed
review comments
1 parent 5609c12 commit 636926b

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Diff for: compiler/rustc_ast_pretty/src/pprust/state/fixup.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use rustc_ast::Expr;
22
use rustc_ast::util::{classify, parser};
33

4-
// The default amount of fixing is minimal fixing. Fixups should be turned on
5-
// in a targeted fashion where needed.
4+
// The default amount of fixing is minimal fixing, so all fixups are set to `false` by `Default`.
5+
// Fixups should be turned on in a targeted fashion where needed.
66
#[derive(Copy, Clone, Debug, Default)]
77
pub(crate) struct FixupContext {
88
/// Print expression such that it can be parsed back as a statement

Diff for: library/core/src/default.rs

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ macro_rules! default_impl {
161161
default_impl! { (), (), "Returns the default value of `()`" }
162162
default_impl! { bool, false, "Returns the default value of `false`" }
163163
default_impl! { char, '\x00', "Returns the default value of `\\x00`" }
164+
default_impl! { AsciiChar, AsciiChar::Null, "Returns the default value of `Null`" }
164165

165166
default_impl! { usize, 0, "Returns the default value of `0`" }
166167
default_impl! { u8, 0, "Returns the default value of `0`" }

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

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

156156
/// What Rustfmt should emit. Mostly corresponds to the `--emit` command line
157157
/// option.
158-
#[derive(Default)]
159158
#[config_type]
160159
pub enum EmitMode {
161160
/// Emits to files.
162-
#[default]
163161
Files,
164162
/// Writes the output to stdout.
165163
Stdout,
@@ -312,6 +310,12 @@ impl ::std::str::FromStr for WidthHeuristics {
312310
}
313311
}
314312

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

423427
/// The edition of the syntax and semantics of code (RFC 2052).
424-
#[derive(Default)]
425428
#[config_type]
426429
pub enum Edition {
427430
#[value = "2015"]
428431
#[doc_hint = "2015"]
429-
#[default]
430432
/// Edition 2015.
431433
Edition2015,
432434
#[value = "2018"]
@@ -443,6 +445,12 @@ pub enum Edition {
443445
Edition2024,
444446
}
445447

448+
impl Default for Edition {
449+
fn default() -> Edition {
450+
Edition::Edition2015
451+
}
452+
}
453+
446454
impl From<Edition> for rustc_span::edition::Edition {
447455
fn from(edition: Edition) -> Self {
448456
match edition {

0 commit comments

Comments
 (0)