Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Oct 5, 2023
1 parent 9de8889 commit fcd751b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion riprip_core/src/cdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl LibcdioInstance {
while from < to && 0 < *todo {
if killed.killed() { break; }
if
! SHITLIST.with(|q| q.borrow().contains(&from)) &&
! SHITLIST.with_borrow(|q| q.contains(&from)) &&
self.read_cd(buf, from, false, 0, CD_DATA_SIZE).is_ok()
{ *todo -= 1; }
from += 1;
Expand Down
2 changes: 1 addition & 1 deletion riprip_core/src/disc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl Disc {
}

// An extra line break for separation.
let _res = writeln!(&mut handle).and_then(|_| handle.flush());
let _res = writeln!(&mut handle).and_then(|()| handle.flush());
}

Ok(())
Expand Down
12 changes: 1 addition & 11 deletions riprip_core/src/drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,9 @@ impl ReadOffset {
/// # Sectors (Absolute).
///
/// Return the minimum containing sector amount.
///
/// TODO: use div_ceil as soon as that is stabilized!
pub const fn sectors_abs(self) -> u16 {
if self.0 == 0 { return 0; }

let samples_abs = self.samples_abs();

// Floor.
let div = samples_abs.wrapping_div(SAMPLES_PER_SECTOR);

// Add one if there's a remainder.
if 0 == samples_abs % SAMPLES_PER_SECTOR { div }
else { div + 1 }
self.samples_abs().div_ceil(SAMPLES_PER_SECTOR)
}
}

Expand Down
2 changes: 1 addition & 1 deletion riprip_core/src/rip/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl RipState {
// The first twelve bytes are reserved for some magic header bits
// and a CRC32 hash of the toc, track, and data.
buf.write_all(MAGIC.as_slice())
.and_then(|_| buf.write_all(self.quick_hash().to_le_bytes().as_slice()))
.and_then(|()| buf.write_all(self.quick_hash().to_le_bytes().as_slice()))
.map_err(|_| RipRipError::StateSave(idx))?;

// Everything else is the sample data…
Expand Down
6 changes: 3 additions & 3 deletions riprip_core/src/rip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<'a> Ripper<'a> {
state_path(toc, entry.track).map_or(false, |s| s.is_file())
{
state.replace(entry.track, &self.opts)?;
if entry.preverify(&mut state, &self.opts)? {
if entry.preverify(&state, &self.opts)? {
share.progress.push_msg(happy_track_msg(entry.track), true);
progress.increment_n(entry.sectors * u32::from(self.opts.passes()));
}
Expand Down Expand Up @@ -534,7 +534,7 @@ impl RipEntry {
/// skip any further work on it.
///
/// This will return `true` if verified.
fn verify(&mut self, state: &mut RipState, opts: &RipOptions, progress: &Progless)
fn verify(&mut self, state: &RipState, opts: &RipOptions, progress: &Progless)
-> bool {
set_progress_title(progress, self.track.number(), "Verifying the rip…");

Expand Down Expand Up @@ -567,7 +567,7 @@ impl RipEntry {
///
/// If the track is confirmed it will be exported here and now; an error
/// will be returned in the unlikely event that fails.
fn preverify(&mut self, state: &mut RipState, opts: &RipOptions)
fn preverify(&mut self, state: &RipState, opts: &RipOptions)
-> Result<bool, RipRipError> {
if ! state.is_new() {
(self.ar, self.ctdb) = verify_track(self.track, state);
Expand Down
4 changes: 1 addition & 3 deletions riprip_core/src/rip/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,9 @@ impl RipOptions {
/// # Cache Sectors.
///
/// Return the cache size in sectors, rounded up.
///
/// TODO: use `div_ceil` once it becomes available.
pub const fn cache_sectors(&self) -> u32 {
if let Some(c) = self.cache {
(c.get() as u32 * 1024).wrapping_div(CD_DATA_SIZE as u32) + 1
(c.get() as u32 * 1024).div_ceil(CD_DATA_SIZE as u32)
}
else { 0 }
}
Expand Down

0 comments on commit fcd751b

Please sign in to comment.