Skip to content

Commit

Permalink
Bump Rust edition and fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
thombles committed Jun 15, 2022
1 parent 28192cf commit 1059251
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/thombles/ax25-rs"
keywords = ["amateur", "radio", "packet", "ham"]
categories = ["network-programming"]
license = "Apache-2.0"
edition = "2018"
edition = "2021"
readme = "README.md"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ fn test_round_trips() {
// Should be identical when re-encoded
assert_eq!(frame_data_fixed, &parsed.to_bytes()[..])
}
Err(e) => assert!(false, "Could not parse! {}", e),
Err(e) => panic!("Could not parse! {}", e),
};
}
}
24 changes: 10 additions & 14 deletions src/tnc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ impl Tnc {
/// Attempt to obtain a `Tnc` connection using the provided address.
pub fn open(address: &TncAddress) -> Result<Self, TncError> {
let imp: Box<dyn TncImpl> = match &address.config {
ConnectConfig::TcpKiss(config) => Box::new(TcpKissTnc::open(&config)?),
ConnectConfig::LinuxIf(config) => Box::new(LinuxIfTnc::open(&config)?),
ConnectConfig::TcpKiss(config) => Box::new(TcpKissTnc::open(config)?),
ConnectConfig::LinuxIf(config) => Box::new(LinuxIfTnc::open(config)?),
};
Ok(Tnc(Arc::new(Mutex::new(TncInner::new(imp)))))
}
Expand Down Expand Up @@ -367,18 +367,14 @@ mod test {
})
})
);
assert!(match "fish".parse::<TncAddress>() {
Err(ParseError::NoTncPrefix { .. }) => true,
_ => false,
});
assert!(match "tnc:".parse::<TncAddress>() {
Err(ParseError::UnknownType { tnc_type }) => tnc_type == "",
_ => false,
});
assert!(match "tnc:fish".parse::<TncAddress>() {
Err(ParseError::UnknownType { tnc_type }) => tnc_type == "fish",
_ => false,
});
assert!(matches!(
"fish".parse::<TncAddress>(),
Err(ParseError::NoTncPrefix { .. })
));
assert!(matches!("tnc:".parse::<TncAddress>(),
Err(ParseError::UnknownType { tnc_type }) if tnc_type.is_empty()));
assert!(matches!("tnc:fish".parse::<TncAddress>(),
Err(ParseError::UnknownType { tnc_type }) if tnc_type == "fish"));
assert!(match "tnc:tcpkiss".parse::<TncAddress>() {
Err(ParseError::WrongParameterCount {
tnc_type,
Expand Down

0 comments on commit 1059251

Please sign in to comment.