Skip to content

Commit

Permalink
[Bugfix] Remove Clippy Mercy for Multiple Crate Versions (#54)
Browse files Browse the repository at this point in the history
* Fixed ::= Clippy:  mercy on multiple crate versions

* Fixed ::= BufReadReader:  rename generics to be more intuitive

* Create summary of recent changes

---------

Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
kevinmatthes and github-actions[bot] committed Jan 18, 2024
1 parent 95ec1d9 commit 847a33b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(
references: {},
changes: {
"Fixed": [
"BufReadReader: rename generics to be more intuitive",
"Clippy: mercy on multiple crate versions",
],
},
)
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
unused_parens,
unused_variables
)]
#![allow(clippy::multiple_crate_versions)]

mod reading;

Expand Down
14 changes: 7 additions & 7 deletions src/reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ impl<T: std::io::BufRead> BufReadReader for T {
}

/// Read from either source, dependending on the circumstances.
pub trait OptionReader<T>
pub trait OptionReader<B>
where
T: BufReadReader,
B: BufReadReader,
{
/// Read from this instance or the given alternative.
///
Expand All @@ -100,7 +100,7 @@ where
/// # Errors
///
/// See [`sysexits::ExitCode`].
fn read_loudly(&self, alternative: T) -> Result<String>;
fn read_loudly(&self, alternative: B) -> Result<String>;

/// Read from this instance or the given alternative.
///
Expand All @@ -120,18 +120,18 @@ where
/// # Errors
///
/// See [`sysexits::ExitCode`].
fn read_silently(&self, alternative: T) -> Result<String>;
fn read_silently(&self, alternative: B) -> Result<String>;
}

impl<P: PathBufLikeReader, T: std::io::BufRead> OptionReader<T> for Option<P> {
fn read_loudly(&self, alternative: T) -> Result<String> {
impl<B: std::io::BufRead, P: PathBufLikeReader> OptionReader<B> for Option<P> {
fn read_loudly(&self, alternative: B) -> Result<String> {
self.as_ref().map_or_else(
|| alternative.read_loudly(),
PathBufLikeReader::read_loudly,
)
}

fn read_silently(&self, alternative: T) -> Result<String> {
fn read_silently(&self, alternative: B) -> Result<String> {
self.as_ref().map_or_else(
|| alternative.read_silently(),
PathBufLikeReader::read_silently,
Expand Down

0 comments on commit 847a33b

Please sign in to comment.