diff --git a/crates/ruma-api/src/error.rs b/crates/ruma-api/src/error.rs index ae5a385c..0dd2505a 100644 --- a/crates/ruma-api/src/error.rs +++ b/crates/ruma-api/src/error.rs @@ -13,6 +13,7 @@ use crate::{EndpointError, OutgoingResponse}; /// A general-purpose Matrix error type consisting of an HTTP status code and a JSON body. /// /// Note that individual `ruma-*-api` crates may provide more specific error types. +#[allow(clippy::exhaustive_structs)] #[derive(Clone, Debug)] pub struct MatrixError { /// The http response's status code. diff --git a/crates/ruma-api/src/lib.rs b/crates/ruma-api/src/lib.rs index 9b9c8cc1..8c1fe9fa 100644 --- a/crates/ruma-api/src/lib.rs +++ b/crates/ruma-api/src/lib.rs @@ -390,6 +390,7 @@ pub enum AuthScheme { /// Metadata about an API endpoint. #[derive(Clone, Debug)] +#[allow(clippy::exhaustive_structs)] pub struct Metadata { /// A human-readable description of the endpoint. pub description: &'static str, diff --git a/crates/ruma-api/tests/conversions.rs b/crates/ruma-api/tests/conversions.rs index c5b53ee0..dba46c71 100644 --- a/crates/ruma-api/tests/conversions.rs +++ b/crates/ruma-api/tests/conversions.rs @@ -1,3 +1,5 @@ +#![allow(clippy::exhaustive_structs)] + use ruma_api::{ ruma_api, IncomingRequest as _, OutgoingRequest as _, OutgoingRequestAppserviceExt, SendAccessToken, diff --git a/crates/ruma-api/tests/header_override.rs b/crates/ruma-api/tests/header_override.rs index 26673996..42533da5 100644 --- a/crates/ruma-api/tests/header_override.rs +++ b/crates/ruma-api/tests/header_override.rs @@ -1,3 +1,5 @@ +#![allow(clippy::exhaustive_structs)] + use http::header::{Entry, CONTENT_TYPE}; use ruma_api::{ruma_api, OutgoingRequest as _, OutgoingResponse as _, SendAccessToken}; diff --git a/crates/ruma-api/tests/manual_endpoint_impl.rs b/crates/ruma-api/tests/manual_endpoint_impl.rs index 1e46a199..bc1d516c 100644 --- a/crates/ruma-api/tests/manual_endpoint_impl.rs +++ b/crates/ruma-api/tests/manual_endpoint_impl.rs @@ -1,5 +1,7 @@ //! PUT /_matrix/client/r0/directory/room/:room_alias +#![allow(clippy::exhaustive_structs)] + use std::convert::TryFrom; use bytes::BufMut; diff --git a/crates/ruma-api/tests/ruma_api_lifetime.rs b/crates/ruma-api/tests/ruma_api_lifetime.rs index c605e5a2..d8347b66 100644 --- a/crates/ruma-api/tests/ruma_api_lifetime.rs +++ b/crates/ruma-api/tests/ruma_api_lifetime.rs @@ -1,4 +1,5 @@ -#[allow(unused)] +#![allow(clippy::exhaustive_structs)] + #[derive(Copy, Clone, Debug, ruma_serde::Outgoing, serde::Serialize)] pub struct OtherThing<'t> { pub some: &'t str, diff --git a/crates/ruma-api/tests/ruma_api_macros.rs b/crates/ruma-api/tests/ruma_api_macros.rs index 6e08c89a..e26b6a21 100644 --- a/crates/ruma-api/tests/ruma_api_macros.rs +++ b/crates/ruma-api/tests/ruma_api_macros.rs @@ -1,3 +1,5 @@ +#![allow(clippy::exhaustive_structs)] + pub mod some_endpoint { use ruma_api::ruma_api; use ruma_events::{tag::TagEvent, AnyRoomEvent}; diff --git a/crates/ruma-client/src/http_client.rs b/crates/ruma-client/src/http_client.rs index ace14b18..caaaa43c 100644 --- a/crates/ruma-client/src/http_client.rs +++ b/crates/ruma-client/src/http_client.rs @@ -118,6 +118,7 @@ impl HttpClientExt for T {} #[doc(hidden)] #[derive(Debug)] +#[allow(clippy::exhaustive_structs)] pub struct Dummy; #[async_trait] diff --git a/crates/ruma-signatures/src/signatures.rs b/crates/ruma-signatures/src/signatures.rs index f8926645..de8cd1ea 100644 --- a/crates/ruma-signatures/src/signatures.rs +++ b/crates/ruma-signatures/src/signatures.rs @@ -8,13 +8,13 @@ use crate::{split_id, Algorithm, Error}; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct Signature { /// The cryptographic algorithm that generated this signature. - pub algorithm: Algorithm, + pub(crate) algorithm: Algorithm, /// The signature data. - pub signature: Vec, + pub(crate) signature: Vec, /// The "version" of the key identifier for the public key used to generate this signature. - pub version: String, + pub(crate) version: String, } impl Signature { diff --git a/crates/ruma-state-res/tests/utils.rs b/crates/ruma-state-res/tests/utils.rs index ed2a8163..b78ba006 100644 --- a/crates/ruma-state-res/tests/utils.rs +++ b/crates/ruma-state-res/tests/utils.rs @@ -1,4 +1,4 @@ -#![allow(clippy::exhaustive_structs, dead_code)] +#![allow(dead_code)] use std::{ collections::{BTreeMap, BTreeSet}, @@ -206,11 +206,11 @@ pub fn do_check( assert_eq!(expected_state, end_state); } +#[allow(clippy::exhaustive_structs)] pub struct TestStore(pub BTreeMap>); -#[allow(unused)] impl TestStore { - pub fn get_event(&self, room_id: &RoomId, event_id: &EventId) -> Result> { + pub fn get_event(&self, _: &RoomId, event_id: &EventId) -> Result> { self.0 .get(event_id) .map(Arc::clone) @@ -544,6 +544,7 @@ pub mod event { } #[derive(Clone, Debug, Deserialize, Serialize)] + #[allow(clippy::exhaustive_structs)] pub struct StateEvent { pub event_id: EventId, #[serde(flatten)] diff --git a/crates/ruma/tests/outgoing.rs b/crates/ruma/tests/outgoing.rs index 955d9f67..a4ca60a4 100644 --- a/crates/ruma/tests/outgoing.rs +++ b/crates/ruma/tests/outgoing.rs @@ -1,6 +1,8 @@ // This test should really be part of ruma_serde, but some tooling doesn't like // cyclic dev-dependencies, which are required for this test to be moved there. +#![allow(clippy::exhaustive_structs)] + use ruma::{Outgoing, UserId}; #[allow(unused)] diff --git a/xtask/src/cargo.rs b/xtask/src/cargo.rs index e1e5845a..99ad702e 100644 --- a/xtask/src/cargo.rs +++ b/xtask/src/cargo.rs @@ -46,7 +46,7 @@ impl Package { /// Update the version of this crate in dependant crates' manifests, with the given version /// prefix. - pub fn update_dependants(&self, metadata: &Metadata) -> Result<()> { + pub(crate) fn update_dependants(&self, metadata: &Metadata) -> Result<()> { for package in metadata.packages.iter().filter(|p| { p.manifest_path.starts_with(&metadata.workspace_root) && p.dependencies.iter().any(|d| d.name == self.name) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index aebe8788..f6bcea5d 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -3,6 +3,8 @@ //! This binary is integrated into the `cargo` command line by using an alias in //! `.cargo/config`. Run commands as `cargo xtask [command]`. +#![allow(clippy::exhaustive_structs)] + use std::path::PathBuf; use serde::Deserialize; @@ -60,7 +62,7 @@ fn try_main() -> Result<()> { /// The metadata of a cargo workspace. #[derive(Clone, Debug, Deserialize)] -pub struct Metadata { +struct Metadata { pub workspace_root: PathBuf, #[cfg(feature = "default")] pub packages: Vec,