Skip to content

Commit

Permalink
Fix compilation error when using without the flate2 feature (#263)
Browse files Browse the repository at this point in the history
When compiling without the default features, the compilation of russh
fail with message concerning unknown Error type in compression.rs and
unknown flate2 crate in lib.rs (when defining the error type)

This PR specify the same Error type as the flate2-featured
Compression/Decompression function and disable error cases specific to
flate2.
  • Loading branch information
citorva committed Mar 27, 2024
1 parent a375283 commit 58d9274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions russh/src/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Compress {
&mut self,
input: &'a [u8],
_: &'a mut russh_cryptovec::CryptoVec,
) -> Result<&'a [u8], Error> {
) -> Result<&'a [u8], crate::Error> {
Ok(input)
}
}
Expand All @@ -82,7 +82,7 @@ impl Decompress {
&mut self,
input: &'a [u8],
_: &'a mut russh_cryptovec::CryptoVec,
) -> Result<&'a [u8], Error> {
) -> Result<&'a [u8], crate::Error> {
Ok(input)
}
}
Expand Down
2 changes: 2 additions & 0 deletions russh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ pub enum Error {
Utf8(#[from] std::str::Utf8Error),

#[error(transparent)]
#[cfg(feature = "flate2")]
Compress(#[from] flate2::CompressError),

#[error(transparent)]
#[cfg(feature = "flate2")]
Decompress(#[from] flate2::DecompressError),

#[error(transparent)]
Expand Down

0 comments on commit 58d9274

Please sign in to comment.