Skip to content

Commit

Permalink
chore: Fix issues reported by Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfloyd committed Dec 12, 2024
1 parent 6438c78 commit ca57592
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/frame/content_cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum ContentCmp<'a> {
Same,
}

impl<'a> PartialEq for ContentCmp<'a> {
impl PartialEq for ContentCmp<'_> {
fn eq(&self, other: &Self) -> bool {
use ContentCmp::*;

Expand Down
4 changes: 2 additions & 2 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub trait StorageFile: io::Read + io::Write + io::Seek + private::Sealed {
fn set_len(&mut self, new_len: u64) -> io::Result<()>;
}

impl<'a, T: StorageFile> StorageFile for &'a mut T {
impl<T: StorageFile> StorageFile for &mut T {
fn set_len(&mut self, new_len: u64) -> io::Result<()> {
(*self).set_len(new_len)
}
Expand All @@ -88,7 +88,7 @@ impl StorageFile for io::Cursor<Vec<u8>> {
mod private {
pub trait Sealed {}

impl<'a, T: Sealed> Sealed for &'a mut T {}
impl<T: Sealed> Sealed for &mut T {}
impl Sealed for std::fs::File {}
impl Sealed for std::io::Cursor<Vec<u8>> {}
}
Expand Down
10 changes: 5 additions & 5 deletions src/storage/plain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct PlainReader<'a, F: StorageFile + 'a> {
storage: &'a mut PlainStorage<F>,
}

impl<'a, F: StorageFile> io::Read for PlainReader<'a, F> {
impl<F: StorageFile> io::Read for PlainReader<'_, F> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let cur_pos = self.storage.file.stream_position()?;
assert!(self.storage.region.start <= cur_pos);
Expand All @@ -62,7 +62,7 @@ impl<'a, F: StorageFile> io::Read for PlainReader<'a, F> {
}
}

impl<'a, F: StorageFile> io::Seek for PlainReader<'a, F> {
impl<F: StorageFile> io::Seek for PlainReader<'_, F> {
fn seek(&mut self, rel_pos: io::SeekFrom) -> io::Result<u64> {
let abs_cur_pos = self.storage.file.stream_position()?;
let abs_pos = match rel_pos {
Expand Down Expand Up @@ -92,7 +92,7 @@ pub struct PlainWriter<'a, F: StorageFile + 'a> {
buffer_changed: bool,
}

impl<'a, F: StorageFile> io::Write for PlainWriter<'a, F> {
impl<F: StorageFile> io::Write for PlainWriter<'_, F> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let nwritten = self.buffer.write(buf)?;
self.buffer_changed = true;
Expand Down Expand Up @@ -185,13 +185,13 @@ impl<'a, F: StorageFile> io::Write for PlainWriter<'a, F> {
}
}

impl<'a, F: StorageFile> io::Seek for PlainWriter<'a, F> {
impl<F: StorageFile> io::Seek for PlainWriter<'_, F> {
fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> {
self.buffer.seek(pos)
}
}

impl<'a, F: StorageFile> Drop for PlainWriter<'a, F> {
impl<F: StorageFile> Drop for PlainWriter<'_, F> {
fn drop(&mut self) {
let _ = self.flush();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tcon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct Parser<'a>(&'a str);
type ParseFunc<P, T> = dyn Fn(&mut P) -> Result<T, ()>;

impl<'a> Parser<'a> {
pub fn parse_tcon(s: &'a str) -> Cow<str> {
pub fn parse_tcon(s: &'a str) -> Cow<'a, str> {
let mut parser = Parser(s);
let v1_genre_ids = match parser.one_or_more(&Self::content_type) {
Ok(v) => v,
Expand Down

0 comments on commit ca57592

Please sign in to comment.