Skip to content

Commit 27f30ca

Browse files
committed
chore: Add rustfmt config, apply changes
1 parent 95352f9 commit 27f30ca

File tree

7 files changed

+34
-14
lines changed

7 files changed

+34
-14
lines changed

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"rust-analyzer.rustfmt.overrideCommand": [
3+
"rustfmt",
4+
"+nightly-2025-05-26",
5+
"--edition",
6+
"2024",
7+
"--"
8+
],
9+
}

rust/boil/src/build/bakefile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl DerefMut for Targets {
9595
}
9696

9797
impl IntoIterator for Targets {
98-
type Item = (String, BTreeMap<String, (ImageOptions, bool)>);
9998
type IntoIter =
10099
std::collections::btree_map::IntoIter<String, BTreeMap<String, (ImageOptions, bool)>>;
100+
type Item = (String, BTreeMap<String, (ImageOptions, bool)>);
101101

102102
fn into_iter(self) -> Self::IntoIter {
103103
self.0.into_iter()

rust/boil/src/build/docker.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ impl Extend<BuildArgument> for BuildArguments {
114114
}
115115

116116
impl IntoIterator for BuildArguments {
117-
type Item = BuildArgument;
118-
119117
type IntoIter = std::collections::btree_set::IntoIter<Self::Item>;
118+
type Item = BuildArgument;
120119

121120
fn into_iter(self) -> Self::IntoIter {
122121
self.0.into_iter()

rust/patchable/src/patch.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ use git2::{Oid, Repository};
77
use snafu::{OptionExt, ResultExt as _, Snafu};
88
use tracing_indicatif::suspend_tracing_indicatif;
99

10+
#[cfg(doc)]
11+
use crate::repo::ensure_worktree_is_at;
1012
use crate::{
1113
error::{self, CommitId},
1214
patch_mail::{self, mailinfo, mailsplit},
1315
utils::raw_git_cmd,
1416
};
1517

16-
#[cfg(doc)]
17-
use crate::repo::ensure_worktree_is_at;
18-
1918
#[derive(Debug, Snafu)]
2019
pub enum Error {
2120
#[snafu(display("failed to open stgit series file {path:?}"))]
@@ -61,14 +60,18 @@ pub enum Error {
6160
source: git2::Error,
6261
parent_commit: error::CommitId,
6362
},
64-
#[snafu(display("failed to apply patch {patch_email_file:?} (from {patch_file:?}) to parent commit {parent_commit}"))]
63+
#[snafu(display(
64+
"failed to apply patch {patch_email_file:?} (from {patch_file:?}) to parent commit {parent_commit}"
65+
))]
6566
ApplyPatch {
6667
source: git2::Error,
6768
parent_commit: error::CommitId,
6869
patch_email_file: PathBuf,
6970
patch_file: PathBuf,
7071
},
71-
#[snafu(display("failed to write tree for patch {patch_email_file:?} (from {patch_file:?}) applied to parent commit {parent_commit}"))]
72+
#[snafu(display(
73+
"failed to write tree for patch {patch_email_file:?} (from {patch_file:?}) applied to parent commit {parent_commit}"
74+
))]
7275
WritePatchedTree {
7376
source: git2::Error,
7477
parent_commit: error::CommitId,
@@ -77,7 +80,9 @@ pub enum Error {
7780
},
7881
#[snafu(display("failed to read patched tree {tree}"))]
7982
ReadPatchedTree { source: git2::Error, tree: Oid },
80-
#[snafu(display("failed to write commit for patch {patch_email_file:?} (from {patch_file:?}) applied to parent commit {parent_commit}"))]
83+
#[snafu(display(
84+
"failed to write commit for patch {patch_email_file:?} (from {patch_file:?}) applied to parent commit {parent_commit}"
85+
))]
8186
WriteCommit {
8287
source: git2::Error,
8388
parent_commit: error::CommitId,

rust/patchable/src/patch_mail.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::{
99

1010
use git2::{Diff, Repository, Signature};
1111
use snafu::{OptionExt as _, ResultExt, Snafu};
12-
use tempfile::{tempdir, NamedTempFile};
13-
use time::{format_description::well_known::Rfc2822, OffsetDateTime};
12+
use tempfile::{NamedTempFile, tempdir};
13+
use time::{OffsetDateTime, format_description::well_known::Rfc2822};
1414
use tracing_indicatif::suspend_tracing_indicatif;
1515

1616
use crate::utils::raw_git_cmd;

rust/patchable/src/repo.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ pub enum Error {
2828
path: PathBuf,
2929
},
3030

31-
#[snafu(display(
32-
"failed to create worktree branch {branch:?} pointing at {commit} in {repo}"
33-
))]
31+
#[snafu(display("failed to create worktree branch {branch:?} pointing at {commit} in {repo}"))]
3432
CreateWorktreeBranch {
3533
source: git2::Error,
3634
repo: error::RepoPath,

rustfmt.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file includes unstable features, so you need to run "cargo +nightly fmt" to format your code.
2+
# It's also ok to use the stable toolchain by simple running "cargo fmt", but using the nigthly formatter is prefered.
3+
4+
# https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rustfmt-style-edition.html
5+
style_edition = "2024"
6+
imports_granularity = "Crate"
7+
group_imports = "StdExternalCrate"
8+
reorder_impl_items = true
9+
use_field_init_shorthand = true

0 commit comments

Comments
 (0)