Skip to content

Commit

Permalink
Merge pull request #79 from wiktor-k/wiktor/disallow-unwraps
Browse files Browse the repository at this point in the history
Propagate error if retrieving encoded length fails instead of panic
  • Loading branch information
wiktor-k authored Jun 7, 2024
2 parents fe210c2 + 4986d0b commit 04504ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
fn encode(&mut self, item: Output, dst: &mut BytesMut) -> Result<(), Self::Error> {
let mut bytes = Vec::new();

let len = item.encoded_len().unwrap() as u32;
let len = item.encoded_len().map_err(ProtoError::SshEncoding)? as u32;
len.encode(&mut bytes).map_err(ProtoError::SshEncoding)?;

item.encode(&mut bytes).map_err(ProtoError::SshEncoding)?;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![deny(missing_debug_implementations)]
#![deny(unsafe_code)]
#![deny(missing_docs)]
#![deny(clippy::unwrap_used)]

pub mod proto;

Expand Down

0 comments on commit 04504ab

Please sign in to comment.