Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use explicit lifetimes
  • Loading branch information
apcamargo committed Dec 10, 2025
commit fb324c71eaf367355520316b3cdcd62cc6a06fa0
2 changes: 1 addition & 1 deletion src/parser/fasta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ where
}

impl<R: io::Read + Send> FastxReader for Reader<R> {
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
if self.finished {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/fastq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ where
}

impl<R: io::Read + Send> FastxReader for Reader<R> {
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
// No more records to read
if self.finished {
return None;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a> SequenceRecord<'a> {

/// Returns the cleaned up sequence of the record. For FASTQ it is the same as `raw_seq` but
/// for FASTA it is `raw_seq` minus all the `\r\n`
pub fn seq(&self) -> Cow<[u8]> {
pub fn seq(&self) -> Cow<'_, [u8]> {
match self.buf_pos {
BufferPositionKind::Fasta(bp) => bp.seq(self.buffer),
BufferPositionKind::Fastq(bp) => bp.seq(self.buffer).into(),
Expand Down
2 changes: 1 addition & 1 deletion src/parser/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub trait FastxReader: Send {
/// Gets the next record in the stream.
/// This imitates the Iterator API but does not support any iterator functions.
/// This returns None once we reached the EOF.
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>>;
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>;
/// Returns the current line/byte in the stream we are reading from
fn position(&self) -> &Position;
/// Returns whether the current stream uses Windows or Unix style line endings
Expand Down
4 changes: 2 additions & 2 deletions src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn complement(n: u8) -> u8 {
/// Taking in a sequence string, return the canonical form of the sequence
/// (e.g. the lexigraphically lowest of either the original sequence or its
/// reverse complement)
pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
pub fn canonical(seq: &[u8]) -> Cow<'_, [u8]> {
let mut buf: Vec<u8> = Vec::with_capacity(seq.len());
// enough just keeps our comparisons from happening after they need to
let mut enough = false;
Expand Down Expand Up @@ -136,7 +136,7 @@ pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
/// Find the lexigraphically smallest substring of `seq` of length `length`
///
/// There's probably a faster algorithm for this somewhere...
pub fn minimizer(seq: &[u8], length: usize) -> Cow<[u8]> {
pub fn minimizer(seq: &[u8], length: usize) -> Cow<'_, [u8]> {
let reverse_complement: Vec<u8> = seq.iter().rev().map(|n| complement(*n)).collect();
let mut minmer = Cow::Borrowed(&seq[..length]);

Expand Down
Loading