Merge branch 'clippy-nightly-20230703' into 'main'

Fix various warnings from clippy nightly

Closes #943

See merge request tpo/core/arti!1369
This commit is contained in:
Nick Mathewson 2023-07-07 12:26:45 +00:00
commit 2b3d4150e3
7 changed files with 17 additions and 17 deletions

View File

@ -1982,7 +1982,7 @@ mod test {
));
let c1 = rt.wait_for(mgr.get_or_launch(&ports, di())).await;
assert!(matches!(c1, Ok(_)));
assert!(c1.is_ok());
});
}

View File

@ -368,7 +368,7 @@ impl FoundConfigFiles<'_> {
fn is_syntactically_directory(p: &Path) -> bool {
use std::path::Component as PC;
match p.components().rev().next() {
match p.components().next_back() {
None => false,
Some(PC::Prefix(_)) | Some(PC::RootDir) | Some(PC::CurDir) | Some(PC::ParentDir) => true,
Some(PC::Normal(_)) => {

View File

@ -158,8 +158,8 @@ mod test {
.err()
};
assert!(matches!(err_from(&[&ipv4, &ipv6, &ed, &rsa]), None));
assert!(matches!(err_from(&[&ipv4, &ed, &rsa]), None));
assert!(err_from(&[&ipv4, &ipv6, &ed, &rsa]).is_none());
assert!(err_from(&[&ipv4, &ed, &rsa]).is_none());
assert!(matches!(
err_from(&[&ipv4, &ed, &ed, &rsa]),
Some(E::DuplicatedId(ID::Ed25519))

View File

@ -273,11 +273,11 @@ mod test {
assert_eq!(map.terminate(ids[2]).unwrap(), ShouldSendEnd::Send);
assert!(matches!(map.get_mut(ids[2]), Some(StreamEnt::EndSent(_))));
assert_eq!(map.terminate(ids[1]).unwrap(), ShouldSendEnd::DontSend);
assert!(matches!(map.get_mut(ids[1]), None));
assert!(map.get_mut(ids[1]).is_none());
// Try receiving an end after a terminate.
assert!(map.ending_msg_received(ids[2]).is_ok());
assert!(matches!(map.get_mut(ids[2]), None));
assert!(map.get_mut(ids[2]).is_none());
Ok(())
}

View File

@ -19,7 +19,7 @@ use async_executors::AsyncStd;
/// Currently, `native_tls` is preferred over `rustls` when both are available,
/// because of its maturity within Arti. However, this might change in the
/// future.
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
pub use AsyncStdNativeTlsRuntime as PreferredRuntime;
#[cfg(all(feature = "rustls", not(feature = "native-tls")))]
@ -27,17 +27,17 @@ pub use AsyncStdRustlsRuntime as PreferredRuntime;
/// A [`Runtime`](crate::Runtime) powered by `async_std` and `native_tls`.
#[derive(Clone)]
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
pub struct AsyncStdNativeTlsRuntime {
/// The actual runtime object.
inner: NativeTlsInner,
}
/// Implementation type for AsyncStdRuntime.
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
type NativeTlsInner = CompoundRuntime<AsyncStd, AsyncStd, AsyncStd, NativeTlsProvider, AsyncStd>;
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
crate::opaque::implement_opaque_runtime! {
AsyncStdNativeTlsRuntime { inner : NativeTlsInner }
}
@ -59,7 +59,7 @@ crate::opaque::implement_opaque_runtime! {
AsyncStdRustlsRuntime { inner: RustlsInner }
}
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
impl AsyncStdNativeTlsRuntime {
/// Return a new [`AsyncStdNativeTlsRuntime`]
///

View File

@ -2,14 +2,14 @@
//!
//! Currently only async_std and tokio are provided.
#[cfg(all(feature = "async-std"))]
#[cfg(feature = "async-std")]
pub(crate) mod async_std;
#[cfg(all(feature = "tokio"))]
#[cfg(feature = "tokio")]
pub(crate) mod tokio;
#[cfg(all(feature = "rustls"))]
#[cfg(feature = "rustls")]
pub(crate) mod rustls;
#[cfg(all(feature = "native-tls"))]
#[cfg(feature = "native-tls")]
pub(crate) mod native_tls;

View File

@ -13,9 +13,9 @@ additional_required = {}
# PreferredRuntime has a somewhat more complexe rule for existing
additional_provided['tor-rtcompat'] = [
('PreferredRuntime', 'all(feature = "native-tls")'),
('PreferredRuntime', 'all(feature = "rustls", not(feature = "native-tls"))'),
('PreferredRuntime', 'feature = "native-tls"'),
('PreferredRuntime', 'feature = "native-tls"'),
('PreferredRuntime', 'all(feature = "rustls", not(feature = "native-tls"))'),
('PreferredRuntime', 'all(feature = "rustls", not(feature = "native-tls"))'),
('NativeTlsProvider', 'all(feature = "native-tls", any(feature = "tokio", feature = "async-std"))'),
('RustlsProvider', 'all(feature = "rustls", any(feature = "tokio", feature = "async-std"))'),