Skip to content

Commit

Permalink
Upgrade to Rust 1.72.0
Browse files Browse the repository at this point in the history
Upgraded to Rust 1.72.0 and then made clippy happy by first running
`cargo clippy --fix` and then fixing some more manually.
  • Loading branch information
hannesdejager committed Sep 7, 2023
1 parent 27b009a commit aa825bd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.67.1
RUST_VERSION: 1.72.0

on:
push:
Expand Down
27 changes: 15 additions & 12 deletions crates/unftp-auth-jsonfile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,18 +501,21 @@ mod test {
);
assert_eq!(json_authenticator.authenticate("carol", &"not so secure".into()).await.unwrap(), DefaultUser);
assert_eq!(json_authenticator.authenticate("dan", &"".into()).await.unwrap(), DefaultUser);
match json_authenticator.authenticate("carol", &"this is the wrong password".into()).await {
Err(AuthenticationError::BadPassword) => assert!(true),
_ => assert!(false),
}
match json_authenticator.authenticate("bella", &"this is the wrong password".into()).await {
Err(AuthenticationError::BadPassword) => assert!(true),
_ => assert!(false),
}
match json_authenticator.authenticate("chuck", &"12345678".into()).await {
Err(AuthenticationError::BadUser) => assert!(true),
_ => assert!(false),
}
let mut is_err = match json_authenticator.authenticate("carol", &"this is the wrong password".into()).await {
Err(AuthenticationError::BadPassword) => true,
_ => false,
};
assert!(is_err);
is_err = match json_authenticator.authenticate("bella", &"this is the wrong password".into()).await {
Err(AuthenticationError::BadPassword) => true,
_ => false,
};
assert!(is_err);
is_err = match json_authenticator.authenticate("chuck", &"12345678".into()).await {
Err(AuthenticationError::BadUser) => true,
_ => false,
};
assert!(is_err);

assert_eq!(
json_authenticator
Expand Down
9 changes: 3 additions & 6 deletions crates/unftp-sbe-fs/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where
let server = s(root.clone()).listen(addr.clone());

tokio::spawn(server);
while !async_ftp::FtpStream::connect(&addr).await.is_ok() {
while async_ftp::FtpStream::connect(&addr).await.is_err() {
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}

Expand All @@ -51,7 +51,7 @@ where

#[fixture]
async fn harness() -> Harness {
custom_server_harness(|root| libunftp::Server::with_fs(root)).await
custom_server_harness(libunftp::Server::with_fs).await
}

#[rstest]
Expand Down Expand Up @@ -285,10 +285,7 @@ mod list {
ensure_login_required(ftp_stream.list(None).await);

ftp_stream.login("hoi", "jij").await.unwrap();
let list = ftp_stream
.list(dir_in_root.path().file_name().map(std::ffi::OsStr::to_str).flatten())
.await
.unwrap();
let list = ftp_stream.list(dir_in_root.path().file_name().and_then(std::ffi::OsStr::to_str)).await.unwrap();
let mut found = false;
for entry in list {
if entry.contains("test.txt") {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
/// Tells whether its OK to not ask for a password when a valid client cert
/// was presented.
async fn cert_auth_sufficient(&self, _username: &str) -> bool {
return false;
false
}

/// Implement to set the name of the authenticator. By default it returns the type signature.
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ pub(crate) use controlchan::reply::{Reply, ReplyCode};
pub(crate) use controlchan::ControlChanMiddleware;
pub(crate) use controlchan::Event;
pub(crate) use controlchan::{ControlChanError, ControlChanErrorKind};
pub(self) use session::{Session, SessionState};
use session::{Session, SessionState};
2 changes: 1 addition & 1 deletion src/server/proxy_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl From<u16> for ProxyMode {

#[derive(Error, Debug)]
#[error("Proxy Protocol Error")]
pub(self) enum ProxyError {
enum ProxyError {
#[error("header doesn't end with CRLF")]
CrlfError,
#[error("header size is incorrect")]
Expand Down

0 comments on commit aa825bd

Please sign in to comment.