Fixed findings

List of Findings

Error: CLIPPY_WARNING: [#def1]
src/cache/check.rs:325:53: warning: called `unwrap` on `err` after checking its variant with `is_some`
#      |
#  324 |                 if err.is_some() {
#      |                 ---------------- help: try: `if let Some(<item>) = err`
#  325 |                     ctx.report.fatal(&format!("{}", err.unwrap()));
#      |                                                     ^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap
#      = note: `#[warn(clippy::unnecessary_unwrap)]` on by default

Error: CLIPPY_WARNING: [#def2]
src/cache/check.rs:361:45: warning: called `unwrap` on `err` after checking its variant with `is_some`
#      |
#  360 |         if err.is_some() {
#      |         ---------------- help: try: `if let Some(<item>) = err`
#  361 |             ctx.report.fatal(&format!("{}", err.unwrap()));
#      |                                             ^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def3]
src/cache/dump.rs:209:55: warning: called `unwrap` on `errs` after checking its variant with `is_some`
#      |
#  208 |         if errs.is_some() && !repair {
#      |            -------------- the check is happening here
#  209 |             return Err(anyhow!("errors in bitset {}", errs.unwrap()));
#      |                                                       ^^^^^^^^^^^^^
#      |
#      = help: try using `match`
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def4]
src/cache/dump.rs:372:30: warning: called `unwrap` on `opts.output` after checking its variant with `is_some`
#      |
#  371 |     let writer: Box<dyn Write> = if opts.output.is_some() {
#      |                                  ------------------------ help: try: `if let Some(<item>) = opts.output`
#  372 |         let f = File::create(opts.output.unwrap()).context(OutputError)?;
#      |                              ^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def5]
src/cache/superblock.rs:200:37: warning: called `unwrap` on `sb.dirty_root` after checking its variant with `is_some`
#      |
#  199 |     if sb.dirty_root.is_some() {
#      |     -------------------------- help: try: `if let Some(<item>) = sb.dirty_root`
#  200 |         w.write_u64::<LittleEndian>(sb.dirty_root.unwrap())?;
#      |                                     ^^^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def6]
src/copier/batcher.rs:49:9: warning: consider using `sort_by_key`
#     |
#  49 |         ops.sort_by(|lhs, rhs| lhs.dst.cmp(&rhs.dst));
#     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#     |
#     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_sort_by
#     = note: `#[warn(clippy::unnecessary_sort_by)]` on by default
#  help: try
#     |
#  49 -         ops.sort_by(|lhs, rhs| lhs.dst.cmp(&rhs.dst));
#  49 +         ops.sort_by_key(|lhs| lhs.dst);
#     |

Error: CLIPPY_WARNING: [#def7]
src/copier/sync_copier.rs:140:9: warning: consider using `sort_by_key`
#      |
#  140 |         reads.sort_by(|lhs, rhs| lhs.block_begin.cmp(&rhs.block_begin));
#      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_sort_by
#  help: try
#      |
#  140 -         reads.sort_by(|lhs, rhs| lhs.block_begin.cmp(&rhs.block_begin));
#  140 +         reads.sort_by_key(|lhs| lhs.block_begin);
#      |

Error: CLIPPY_WARNING: [#def8]
src/copier/sync_copier.rs:205:9: warning: consider using `sort_by_key`
#      |
#  205 |         writes.sort_by(|lhs, rhs| lhs.block_begin.cmp(&rhs.block_begin));
#      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_sort_by
#  help: try
#      |
#  205 -         writes.sort_by(|lhs, rhs| lhs.block_begin.cmp(&rhs.block_begin));
#  205 +         writes.sort_by_key(|lhs| lhs.block_begin);
#      |

Error: CLIPPY_WARNING: [#def9]
src/era/check.rs:127:45: warning: called `unwrap` on `err` after checking its variant with `is_some`
#      |
#  126 |         if err.is_some() {
#      |         ---------------- help: try: `if let Some(<item>) = err`
#  127 |             ctx.report.fatal(&format!("{}", err.unwrap()));
#      |                                             ^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def10]
src/era/dump.rs:462:30: warning: called `unwrap` on `opts.output` after checking its variant with `is_some`
#      |
#  461 |     let writer: Box<dyn Write> = if opts.output.is_some() {
#      |                                  ------------------------ help: try: `if let Some(<item>) = opts.output`
#  462 |         let f = File::create(opts.output.unwrap()).context(OutputError)?;
#      |                              ^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def11]
src/era/invalidate.rs:258:46: warning: called `unwrap` on `opts.output` after checking its variant with `is_some`
#      |
#  257 |     let w: Box<dyn Write> = if opts.output.is_some() {
#      |                             ------------------------ help: try: `if let Some(<item>) = opts.output`
#  258 |         Box::new(BufWriter::new(File::create(opts.output.unwrap())?))
#      |                                              ^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Error: CLIPPY_WARNING: [#def12]
src/pdata/space_map/aggregator_load.rs:163:21: warning: the variable `blocknr` is used as a loop counter
#      |
#  163 |                     for e in bitmap.entries.iter() {
#      |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (blocknr, e) in (block_index * ENTRIES_PER_BITMAP as u64..).zip(bitmap.entries.iter())`
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#explicit_counter_loop
#      = note: `#[warn(clippy::explicit_counter_loop)]` on by default

Error: CLIPPY_WARNING: [#def13]
src/pdata/space_map/repairer.rs:36:13: warning: the variable `blocknr` is used as a loop counter
#     |
#  36 |             for e in bitmap.entries.iter_mut() {
#     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (blocknr, e) in (be.blocknr..).zip(bitmap.entries.iter_mut())`
#     |
#     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#explicit_counter_loop

Error: CLIPPY_WARNING: [#def14]
src/thin/dump.rs:413:30: warning: called `unwrap` on `opts.output` after checking its variant with `is_some`
#      |
#  412 |     let writer: Box<dyn Write> = if opts.output.is_some() {
#      |                                  ------------------------ help: try: `if let Some(<item>) = opts.output`
#  413 |         let f = File::create(opts.output.unwrap()).context(OutputError)?;
#      |                              ^^^^^^^^^^^^^^^^^^^^
#      |
#      = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#unnecessary_unwrap

Scan Properties

analyzer-version-clippy1.97.1
analyzer-version-cppcheck2.21.1
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.97.1
diffbase-analyzer-version-cppcheck2.21.1
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-101.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namedevice-mapper-persistent-data-1.3.3-2.fc45
diffbase-store-results-to/tmp/tmp_ehtku3e/device-mapper-persistent-data-1.3.3-2.fc45.tar.xz
diffbase-time-created2026-08-03 13:56:38
diffbase-time-finished2026-08-03 14:00:15
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmp_ehtku3e/device-mapper-persistent-data-1.3.3-2.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmp_ehtku3e/device-mapper-persistent-data-1.3.3-2.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.7.HEAD-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-101.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namedevice-mapper-persistent-data-1.3.1-3.fc44
store-results-to/tmp/tmpwa6u2_sg/device-mapper-persistent-data-1.3.1-3.fc44.tar.xz
time-created2026-08-03 13:51:49
time-finished2026-08-03 13:56:14
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpwa6u2_sg/device-mapper-persistent-data-1.3.1-3.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpwa6u2_sg/device-mapper-persistent-data-1.3.1-3.fc44.src.rpm'
tool-versioncsmock-3.8.7.HEAD-1.el9