Skip to content

Commit

Permalink
fix: Fix rustfmt formatting after previous commit fix
Browse files Browse the repository at this point in the history
The enums modified here were not properly formatted.
The fix in the previous commit now formats them properly.

-> Regardless of the presence of comments or macro attributes, if any of
the enum items is multi-line, all enum items should be formatted as
multi-line.
  • Loading branch information
malikolivier committed Aug 18, 2024
1 parent 6f204cd commit 757e73d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
12 changes: 9 additions & 3 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ enum Operation {
/// Print version information
Version,
/// Output default config to a file, or stdout if None
ConfigOutputDefault { path: Option<String> },
ConfigOutputDefault {
path: Option<String>,
},
/// Output current config (as if formatting to a file) to stdout
ConfigOutputCurrent { path: Option<String> },
ConfigOutputCurrent {
path: Option<String>,
},
/// No file specified, read from stdin
Stdin { input: String },
Stdin {
input: String,
},
}

/// Rustfmt operations errors.
Expand Down
8 changes: 6 additions & 2 deletions src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ pub struct ModuleResolutionError {
pub(crate) enum ModuleResolutionErrorKind {
/// Find a file that cannot be parsed.
#[error("cannot parse {file}")]
ParseError { file: PathBuf },
ParseError {
file: PathBuf,
},
/// File cannot be found.
#[error("{file} does not exist")]
NotFound { file: PathBuf },
NotFound {
file: PathBuf,
},
/// File a.rs and a/mod.rs both exist
#[error("file for module found at both {default_path:?} and {secondary_path:?}")]
MultipleCandidates {
Expand Down
5 changes: 1 addition & 4 deletions tests/target/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ pub enum EnumWithAttributes {
SkippedItem(String,String,), // Post-comment
#[another_attr]
#[attr2]
ItemStruct {
x: usize,
y: usize,
}, /* Comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
ItemStruct { x: usize, y: usize }, /* Comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
// And another
ForcedPreflight, /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
Expand Down

0 comments on commit 757e73d

Please sign in to comment.