Skip to content

Commit c756056

Browse files
committed
refactor: repair clippy lints
1 parent c6e762d commit c756056

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/cmd/series.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -525,19 +525,20 @@ fn run(matches: &ArgMatches) -> Result<()> {
525525
let indices_flag = matches.get_flag("indices");
526526
let offsets_flag = matches.get_flag("offsets");
527527

528-
let index_width = (indices_flag && !patches.is_empty())
529-
.then(|| patches.last().unwrap().index.to_string().len())
530-
.unwrap_or_default();
531-
532-
let offset_width = (offsets_flag && !patches.is_empty())
533-
.then(|| {
534-
[patches.first().unwrap(), patches.last().unwrap()]
535-
.iter()
536-
.map(|entry| format!("{:+}", entry.offset_from_top).len())
537-
.max()
538-
.unwrap()
539-
})
540-
.unwrap_or_default();
528+
let index_width = if indices_flag && !patches.is_empty() {
529+
patches.last().unwrap().index.to_string().len()
530+
} else {
531+
Default::default()
532+
};
533+
let offset_width = if offsets_flag && !patches.is_empty() {
534+
[patches.first().unwrap(), patches.last().unwrap()]
535+
.iter()
536+
.map(|entry| format!("{:+}", entry.offset_from_top).len())
537+
.max()
538+
.unwrap()
539+
} else {
540+
Default::default()
541+
};
541542

542543
let mut stdout = crate::color::get_color_stdout(matches);
543544
let mut color_spec = termcolor::ColorSpec::new();

src/stack/upgrade.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn stack_upgrade_from_2(repo: &gix::Repository, branch_name: &str) -> Result<()>
312312
/// Remove the stack's format version from the config.
313313
fn rm_stackformatversion(repo: &gix::Repository, branch_name: &str) -> Result<()> {
314314
let section = "branch";
315-
let subsection = format!("{}.stgit", branch_name);
315+
let subsection = format!("{branch_name}.stgit");
316316
let subsection = subsection.as_str();
317317

318318
let mut local_config_file = repo.local_config_file()?;
@@ -337,7 +337,7 @@ fn rm_stackformatversion(repo: &gix::Repository, branch_name: &str) -> Result<()
337337
/// Set the stack's protected state in the config.
338338
fn set_protected(repo: &gix::Repository, branch_name: &str) -> Result<()> {
339339
let section = "branch";
340-
let subsection = format!("{}.stgit", branch_name);
340+
let subsection = format!("{branch_name}.stgit");
341341
let subsection = subsection.as_str();
342342

343343
let mut local_config_file = repo.local_config_file()?;

0 commit comments

Comments
 (0)