Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
These were introduced in rustc 1.83.0 (90b35a623 2024-11-26):

  * `clippy::empty_line_after_doc_comments`,
  * `clippy::needless_lifetimes`,
  * `clippy::needless_return`,
  * `elided_named_lifetimes`, and
  * `non_local_definitions`.
  • Loading branch information
zaeleus committed Nov 30, 2024
1 parent 931b3bf commit 5110de4
Show file tree
Hide file tree
Showing 77 changed files with 143 additions and 146 deletions.
2 changes: 1 addition & 1 deletion noodles-bam/src/async/io/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ where
pub fn record_bufs<'a>(
&'a mut self,
_header: &'a sam::Header,
) -> impl Stream<Item = io::Result<RecordBuf>> + '_ {
) -> impl Stream<Item = io::Result<RecordBuf>> + 'a {
Box::pin(stream::try_unfold(
(&mut self.inner, &mut self.buf, RecordBuf::default()),
move |(reader, buf, mut record)| async move {
Expand Down
4 changes: 2 additions & 2 deletions noodles-bam/src/io/indexed_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ where

/// Returns an iterator over alignment record buffers starting from the current stream
/// position.
pub fn record_bufs<'a>(&'a mut self, header: &'a sam::Header) -> RecordBufs<'_, R> {
pub fn record_bufs<'a>(&'a mut self, header: &'a sam::Header) -> RecordBufs<'a, R> {
self.inner.record_bufs(header)
}

Expand Down Expand Up @@ -104,7 +104,7 @@ where
&'a mut self,
header: &'a sam::Header,
region: &Region,
) -> io::Result<Query<'_, R>> {
) -> io::Result<Query<'a, R>> {
self.inner.query(header, &self.index, region)
}

Expand Down
2 changes: 1 addition & 1 deletion noodles-bam/src/io/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ where
/// }
/// # Ok::<_, io::Error>(())
/// ```
pub fn record_bufs<'a>(&'a mut self, header: &'a sam::Header) -> RecordBufs<'_, R> {
pub fn record_bufs<'a>(&'a mut self, header: &'a sam::Header) -> RecordBufs<'a, R> {
RecordBufs::new(self, header)
}

Expand Down
2 changes: 1 addition & 1 deletion noodles-bam/src/io/reader/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
}
}

impl<'a, R> Iterator for Query<'a, R>
impl<R> Iterator for Query<'_, R>
where
R: bgzf::io::BufRead + bgzf::io::Seek,
{
Expand Down
2 changes: 1 addition & 1 deletion noodles-bam/src/io/reader/record_bufs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where
}
}

impl<'a, R> Iterator for RecordBufs<'a, R>
impl<R> Iterator for RecordBufs<'_, R>
where
R: Read,
{
Expand Down
2 changes: 1 addition & 1 deletion noodles-bam/src/io/reader/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ where
}
}

impl<'a, R> Iterator for Records<'a, R>
impl<R> Iterator for Records<'_, R>
where
R: Read,
{
Expand Down
6 changes: 3 additions & 3 deletions noodles-bam/src/record/cigar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<'a> Cigar<'a> {
}
}

impl<'a> sam::alignment::record::Cigar for Cigar<'a> {
impl sam::alignment::record::Cigar for Cigar<'_> {
fn is_empty(&self) -> bool {
self.is_empty()
}
Expand All @@ -53,13 +53,13 @@ impl<'a> sam::alignment::record::Cigar for Cigar<'a> {
}
}

impl<'a> AsRef<[u8]> for Cigar<'a> {
impl AsRef<[u8]> for Cigar<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
}

impl<'a> fmt::Debug for Cigar<'a> {
impl fmt::Debug for Cigar<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.iter()).finish()
}
Expand Down
6 changes: 3 additions & 3 deletions noodles-bam/src/record/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'a> Data<'a> {
}
}

impl<'a> fmt::Debug for Data<'a> {
impl fmt::Debug for Data<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut formatter = f.debug_map();

Expand All @@ -70,7 +70,7 @@ impl<'a> fmt::Debug for Data<'a> {
}
}

impl<'a> sam::alignment::record::Data for Data<'a> {
impl sam::alignment::record::Data for Data<'_> {
fn is_empty(&self) -> bool {
self.is_empty()
}
Expand All @@ -84,7 +84,7 @@ impl<'a> sam::alignment::record::Data for Data<'a> {
}
}

impl<'a> AsRef<[u8]> for Data<'a> {
impl AsRef<[u8]> for Data<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
Expand Down
14 changes: 7 additions & 7 deletions noodles-bam/src/record/data/field/value/array/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'a, N> Values<'a, N> {
}
}

impl<'a> Values<'a, i8> {
impl Values<'_, i8> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<i8>> + '_ {
self.src.iter().map(|&b| Ok(b as i8))
Expand All @@ -35,7 +35,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, i8> for V
}
}

impl<'a> Values<'a, u8> {
impl Values<'_, u8> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<u8>> + '_ {
self.src.iter().copied().map(Ok)
Expand All @@ -52,7 +52,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, u8> for V
}
}

impl<'a> Values<'a, i16> {
impl Values<'_, i16> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<i16>> + '_ {
self.src.chunks(mem::size_of::<i16>()).map(|chunk| {
Expand All @@ -74,7 +74,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, i16> for
}
}

impl<'a> Values<'a, u16> {
impl Values<'_, u16> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<u16>> + '_ {
self.src.chunks(mem::size_of::<u16>()).map(|chunk| {
Expand All @@ -96,7 +96,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, u16> for
}
}

impl<'a> Values<'a, i32> {
impl Values<'_, i32> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<i32>> + '_ {
self.src.chunks(mem::size_of::<i32>()).map(|chunk| {
Expand All @@ -118,7 +118,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, i32> for
}
}

impl<'a> Values<'a, u32> {
impl Values<'_, u32> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<u32>> + '_ {
self.src.chunks(mem::size_of::<u32>()).map(|chunk| {
Expand All @@ -140,7 +140,7 @@ impl<'a> sam::alignment::record::data::field::value::array::Values<'a, u32> for
}
}

impl<'a> Values<'a, f32> {
impl Values<'_, f32> {
/// Returns an iterator over values.
pub fn iter(&self) -> impl Iterator<Item = io::Result<f32>> + '_ {
self.src.chunks(mem::size_of::<f32>()).map(|chunk| {
Expand Down
4 changes: 2 additions & 2 deletions noodles-bam/src/record/quality_scores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> QualityScores<'a> {
}
}

impl<'a> sam::alignment::record::QualityScores for QualityScores<'a> {
impl sam::alignment::record::QualityScores for QualityScores<'_> {
fn is_empty(&self) -> bool {
self.is_empty()
}
Expand All @@ -36,7 +36,7 @@ impl<'a> sam::alignment::record::QualityScores for QualityScores<'a> {
}
}

impl<'a> AsRef<[u8]> for QualityScores<'a> {
impl AsRef<[u8]> for QualityScores<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
Expand Down
8 changes: 4 additions & 4 deletions noodles-bam/src/record/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<'a> Sequence<'a> {
}
}

impl<'a> sam::alignment::record::Sequence for Sequence<'a> {
impl sam::alignment::record::Sequence for Sequence<'_> {
fn is_empty(&self) -> bool {
self.is_empty()
}
Expand Down Expand Up @@ -102,17 +102,17 @@ impl<'a> sam::alignment::record::Sequence for Sequence<'a> {
}
}

impl<'a> AsRef<[u8]> for Sequence<'a> {
impl AsRef<[u8]> for Sequence<'_> {
fn as_ref(&self) -> &[u8] {
self.src
}
}

impl<'a> fmt::Debug for Sequence<'a> {
impl fmt::Debug for Sequence<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct BasesFormat<'a>(&'a Sequence<'a>);

impl<'a> fmt::Debug for BasesFormat<'a> {
impl fmt::Debug for BasesFormat<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_char('"')?;

Expand Down
8 changes: 4 additions & 4 deletions noodles-bam/src/record/sequence/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a> Iter<'a> {
}
}

impl<'a> Iterator for Iter<'a> {
impl Iterator for Iter<'_> {
type Item = u8;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -62,7 +62,7 @@ impl<'a> Iterator for Iter<'a> {
}
}

impl<'a> DoubleEndedIterator for Iter<'a> {
impl DoubleEndedIterator for Iter<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
loop {
if let Some(base) = self.back.as_mut().and_then(|iter| iter.next_back()) {
Expand All @@ -77,9 +77,9 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
}
}

impl<'a> ExactSizeIterator for Iter<'a> {}
impl ExactSizeIterator for Iter<'_> {}

impl<'a> FusedIterator for Iter<'a> {}
impl FusedIterator for Iter<'_> {}

pub(super) fn decoded_bases(n: u8) -> array::IntoIter<u8, 2> {
[decode_base(n >> 4), decode_base(n)].into_iter()
Expand Down
2 changes: 1 addition & 1 deletion noodles-bam/src/record/sequence/subsequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'a> Subsequence<'a> {
}
}

impl<'a> sam::alignment::record::Sequence for Subsequence<'a> {
impl sam::alignment::record::Sequence for Subsequence<'_> {
fn is_empty(&self) -> bool {
self.is_empty()
}
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/io/reader/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ where
}
}

impl<'r, 'h, R> Iterator for Query<'r, 'h, R>
impl<R> Iterator for Query<'_, '_, R>
where
R: bgzf::io::BufRead + bgzf::io::Seek,
{
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/io/reader/record_bufs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ where
}
}

impl<'r, 'h, R> Iterator for RecordBufs<'r, 'h, R>
impl<R> Iterator for RecordBufs<'_, '_, R>
where
R: Read,
{
Expand Down
4 changes: 2 additions & 2 deletions noodles-bcf/src/record/alternate_bases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ impl<'a> AlternateBases<'a> {
}
}

impl<'a> AsRef<[u8]> for AlternateBases<'a> {
impl AsRef<[u8]> for AlternateBases<'_> {
fn as_ref(&self) -> &[u8] {
self.src
}
}

impl<'a> vcf::variant::record::AlternateBases for AlternateBases<'a> {
impl vcf::variant::record::AlternateBases for AlternateBases<'_> {
fn is_empty(&self) -> bool {
self.len == 0
}
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/record/codec/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum Value<'a> {
Array(Array<'a>),
}

impl<'a> Value<'a> {
impl Value<'_> {
pub fn as_int(&self) -> Option<i32> {
match self {
Self::Int8(Some(Int8::Value(n))) => Some(i32::from(*n)),
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/record/codec/value/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum Array<'a> {
Float(Box<dyn Values<'a, f32> + 'a>),
}

impl<'a> fmt::Debug for Array<'a> {
impl fmt::Debug for Array<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Int8(values) => f.debug_list().entries(values.iter()).finish(),
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/record/codec/value/array/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub trait Values<'a, N> {
fn iter(&self) -> Box<dyn Iterator<Item = io::Result<N>> + '_>;
}

impl<'a, N> Values<'a, N> for Vec<N>
impl<N> Values<'_, N> for Vec<N>
where
N: Copy,
{
Expand Down
4 changes: 2 additions & 2 deletions noodles-bcf/src/record/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ impl<'r> Filters<'r> {
}
}

impl<'r> AsRef<[u8]> for Filters<'r> {
impl AsRef<[u8]> for Filters<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
}

impl<'r> vcf::variant::record::Filters for Filters<'r> {
impl vcf::variant::record::Filters for Filters<'_> {
fn is_empty(&self) -> bool {
self.len() == 0
}
Expand Down
4 changes: 2 additions & 2 deletions noodles-bcf/src/record/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ impl<'a> Ids<'a> {
}
}

impl<'a> AsRef<[u8]> for Ids<'a> {
impl AsRef<[u8]> for Ids<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
}

impl<'a> vcf::variant::record::Ids for Ids<'a> {
impl vcf::variant::record::Ids for Ids<'_> {
fn is_empty(&self) -> bool {
self.0.is_empty()
}
Expand Down
4 changes: 2 additions & 2 deletions noodles-bcf/src/record/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ impl<'r> Info<'r> {
}
}

impl<'r> AsRef<[u8]> for Info<'r> {
impl AsRef<[u8]> for Info<'_> {
fn as_ref(&self) -> &[u8] {
self.src
}
}

impl<'r> vcf::variant::record::Info for Info<'r> {
impl vcf::variant::record::Info for Info<'_> {
fn is_empty(&self) -> bool {
self.len() == 0
}
Expand Down
2 changes: 1 addition & 1 deletion noodles-bcf/src/record/info/field/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<T> Once<T> {
}
}

impl<'a, T> vcf::variant::record::info::field::value::array::Values<'a, T> for Once<T>
impl<T> vcf::variant::record::info::field::value::array::Values<'_, T> for Once<T>
where
T: Copy,
{
Expand Down
4 changes: 2 additions & 2 deletions noodles-bcf/src/record/reference_bases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ impl<'a> ReferenceBases<'a> {
}
}

impl<'a> AsRef<[u8]> for ReferenceBases<'a> {
impl AsRef<[u8]> for ReferenceBases<'_> {
fn as_ref(&self) -> &[u8] {
self.0
}
}

impl<'a> vcf::variant::record::ReferenceBases for ReferenceBases<'a> {
impl vcf::variant::record::ReferenceBases for ReferenceBases<'_> {
fn is_empty(&self) -> bool {
self.0.is_empty()
}
Expand Down
Loading

0 comments on commit 5110de4

Please sign in to comment.