Skip to content

Commit d74f310

Browse files
committed
style(clippy): fix
1 parent c41cd7e commit d74f310

7 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/bq/reader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ impl MmapReader {
508508
}
509509

510510
/// Creates a new quality score buffer
511+
#[must_use]
511512
pub fn build_qbuf(&self) -> Vec<u8> {
512513
vec![self.default_quality_score; self.header.slen.max(self.header.xlen) as usize]
513514
}

src/bq/writer.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ impl Encoder {
133133
}
134134

135135
/// Returns whether the header is paired-end.
136+
#[must_use]
136137
pub fn is_paired(&self) -> bool {
137138
self.header.is_paired()
138139
}
@@ -494,13 +495,11 @@ impl<W: Write> BinseqWriter<W> {
494495
} else {
495496
Ok(false)
496497
}
498+
} else if let Some(buffer) = self.encoder.encode_single(record.s_seq)? {
499+
write_buffer(&mut self.inner, buffer)?;
500+
Ok(true)
497501
} else {
498-
if let Some(buffer) = self.encoder.encode_single(record.s_seq)? {
499-
write_buffer(&mut self.inner, buffer)?;
500-
Ok(true)
501-
} else {
502-
Ok(false)
503-
}
502+
Ok(false)
504503
}
505504
}
506505

src/cbq/core/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl ColumnarBlock {
513513
if *len as usize > self.qbuf.len() {
514514
self.qbuf.resize(*len as usize, self.default_quality_score);
515515
}
516-
})
516+
});
517517
}
518518

519519
// decompress header lengths
@@ -721,7 +721,7 @@ impl<'a> Iterator for RefRecordIter<'a> {
721721
let record = RefRecord {
722722
block: self.block,
723723
index: self.index,
724-
qbuf: &self.qbuf,
724+
qbuf: self.qbuf,
725725
global_index,
726726
sseq_span,
727727
sheader_span,

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub enum WriteError {
256256
#[error("Incompatible headers found in VBinseqWriter::ingest. Found ({1:?}) Expected ({0:?})")]
257257
IncompatibleHeaders(crate::vbq::VBinseqHeader, crate::vbq::VBinseqHeader),
258258

259-
/// When building a SequencingRecord without a primary sequence
259+
/// When building a `SequencingRecord` without a primary sequence
260260
#[error("SequencingRecordBuilder requires a primary sequence (s_seq)")]
261261
MissingSequence,
262262
}

src/record/sequencing_record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl<'a> SequencingRecordBuilder<'a> {
265265
self
266266
}
267267

268-
/// Builds the SequencingRecord
268+
/// Builds the `SequencingRecord`
269269
///
270270
/// # Errors
271271
///

src/vbq/writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ impl BlockWriter {
917917

918918
// Write the lengths
919919
self.write_length(record.s_seq.len() as u64)?;
920-
self.write_length(record.x_seq.map_or(0, |x| x.len()) as u64)?;
920+
self.write_length(record.x_seq.map_or(0, <[u8]>::len) as u64)?;
921921

922922
// Write the primary sequence and optional quality
923923
self.write_buffer(sbuf)?;

src/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl FromStr for Format {
8181
"bq" | "BQ" | "b" => Ok(Self::Bq),
8282
"vbq" | "VBQ" | "v" => Ok(Self::Vbq),
8383
"cbq" | "CBQ" | "c" => Ok(Self::Cbq),
84-
_ => Err(format!("Unknown format: {}", s)),
84+
_ => Err(format!("Unknown format: {s}")),
8585
}
8686
}
8787
}
@@ -381,7 +381,7 @@ impl<W: Write> BinseqWriter<W> {
381381
/// Returns an error if there's an I/O error writing the final data.
382382
pub fn finish(&mut self) -> Result<()> {
383383
match self {
384-
Self::Bq(w) => w.flush().map_err(Into::into),
384+
Self::Bq(w) => w.flush(),
385385
Self::Vbq(w) => w.finish(),
386386
Self::Cbq(w) => w.finish(),
387387
}

0 commit comments

Comments
 (0)