misc: Allow exhaustive for non api related structs

This commit is contained in:
Devin Ragotzy 2021-06-13 15:42:09 -04:00 committed by Jonas Platte
parent 6d0ff8b876
commit 337b1e26ef
13 changed files with 26 additions and 9 deletions

View File

@ -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.

View File

@ -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,

View File

@ -1,3 +1,5 @@
#![allow(clippy::exhaustive_structs)]
use ruma_api::{
ruma_api, IncomingRequest as _, OutgoingRequest as _, OutgoingRequestAppserviceExt,
SendAccessToken,

View File

@ -1,3 +1,5 @@
#![allow(clippy::exhaustive_structs)]
use http::header::{Entry, CONTENT_TYPE};
use ruma_api::{ruma_api, OutgoingRequest as _, OutgoingResponse as _, SendAccessToken};

View File

@ -1,5 +1,7 @@
//! PUT /_matrix/client/r0/directory/room/:room_alias
#![allow(clippy::exhaustive_structs)]
use std::convert::TryFrom;
use bytes::BufMut;

View File

@ -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,

View File

@ -1,3 +1,5 @@
#![allow(clippy::exhaustive_structs)]
pub mod some_endpoint {
use ruma_api::ruma_api;
use ruma_events::{tag::TagEvent, AnyRoomEvent};

View File

@ -118,6 +118,7 @@ impl<T: HttpClient> HttpClientExt for T {}
#[doc(hidden)]
#[derive(Debug)]
#[allow(clippy::exhaustive_structs)]
pub struct Dummy;
#[async_trait]

View File

@ -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<u8>,
pub(crate) signature: Vec<u8>,
/// The "version" of the key identifier for the public key used to generate this signature.
pub version: String,
pub(crate) version: String,
}
impl Signature {

View File

@ -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<E: Event>(pub BTreeMap<EventId, Arc<E>>);
#[allow(unused)]
impl<E: Event> TestStore<E> {
pub fn get_event(&self, room_id: &RoomId, event_id: &EventId) -> Result<Arc<E>> {
pub fn get_event(&self, _: &RoomId, event_id: &EventId) -> Result<Arc<E>> {
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)]

View File

@ -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)]

View File

@ -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)

View File

@ -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<cargo::Package>,