mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
enable enum_variant_names lint
This commit is contained in:
parent
2ff08c9fc4
commit
bc2f7c6826
4 changed files with 16 additions and 19 deletions
|
|
@ -48,9 +48,6 @@ unseparated_literal_suffix = "warn"
|
||||||
verbose_file_reads = "warn"
|
verbose_file_reads = "warn"
|
||||||
wildcard_dependencies = "warn"
|
wildcard_dependencies = "warn"
|
||||||
|
|
||||||
# TODO: Remove these
|
|
||||||
enum_variant_names = "allow"
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "grapevine"
|
name = "grapevine"
|
||||||
description = "A Matrix homeserver written in Rust"
|
description = "A Matrix homeserver written in Rust"
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ where
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
debug!("Returning error from {destination}");
|
debug!("Returning error from {destination}");
|
||||||
Err(Error::FederationError(
|
Err(Error::Federation(
|
||||||
destination.to_owned(),
|
destination.to_owned(),
|
||||||
RumaError::from_http_response(http_response),
|
RumaError::from_http_response(http_response),
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ impl PduEvent {
|
||||||
let mut content = serde_json::from_str(self.content.get())
|
let mut content = serde_json::from_str(self.content.get())
|
||||||
.map_err(|_| Error::bad_database("PDU in db has invalid content."))?;
|
.map_err(|_| Error::bad_database("PDU in db has invalid content."))?;
|
||||||
redact_content_in_place(&mut content, &room_version_id, self.kind.to_string())
|
redact_content_in_place(&mut content, &room_version_id, self.kind.to_string())
|
||||||
.map_err(|e| Error::RedactionError(self.sender.server_name().to_owned(), e))?;
|
.map_err(|e| Error::Redaction(self.sender.server_name().to_owned(), e))?;
|
||||||
|
|
||||||
self.unsigned = Some(to_raw_value(&json!({
|
self.unsigned = Some(to_raw_value(&json!({
|
||||||
"redacted_because": serde_json::to_value(reason).expect("to_value(PduEvent) always works")
|
"redacted_because": serde_json::to_value(reason).expect("to_value(PduEvent) always works")
|
||||||
|
|
|
||||||
|
|
@ -19,35 +19,35 @@ pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
|
||||||
pub(crate) enum Error {
|
pub(crate) enum Error {
|
||||||
#[cfg(feature = "sqlite")]
|
#[cfg(feature = "sqlite")]
|
||||||
#[error("There was a problem with the connection to the sqlite database: {source}")]
|
#[error("There was a problem with the connection to the sqlite database: {source}")]
|
||||||
SqliteError {
|
Sqlite {
|
||||||
#[from]
|
#[from]
|
||||||
source: rusqlite::Error,
|
source: rusqlite::Error,
|
||||||
},
|
},
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
#[error("There was a problem with the connection to the rocksdb database: {source}")]
|
#[error("There was a problem with the connection to the rocksdb database: {source}")]
|
||||||
RocksDbError {
|
RocksDb {
|
||||||
#[from]
|
#[from]
|
||||||
source: rocksdb::Error,
|
source: rocksdb::Error,
|
||||||
},
|
},
|
||||||
#[error("Could not generate an image.")]
|
#[error("Could not generate an image.")]
|
||||||
ImageError {
|
Image {
|
||||||
#[from]
|
#[from]
|
||||||
source: image::error::ImageError,
|
source: image::error::ImageError,
|
||||||
},
|
},
|
||||||
#[error("Could not connect to server: {source}")]
|
#[error("Could not connect to server: {source}")]
|
||||||
ReqwestError {
|
Reqwest {
|
||||||
#[from]
|
#[from]
|
||||||
source: reqwest::Error,
|
source: reqwest::Error,
|
||||||
},
|
},
|
||||||
#[error("Could build regular expression: {source}")]
|
#[error("Could build regular expression: {source}")]
|
||||||
RegexError {
|
Regex {
|
||||||
#[from]
|
#[from]
|
||||||
source: regex::Error,
|
source: regex::Error,
|
||||||
},
|
},
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
FederationError(OwnedServerName, RumaError),
|
Federation(OwnedServerName, RumaError),
|
||||||
#[error("Could not do this io: {source}")]
|
#[error("Could not do this io: {source}")]
|
||||||
IoError {
|
Io {
|
||||||
#[from]
|
#[from]
|
||||||
source: std::io::Error,
|
source: std::io::Error,
|
||||||
},
|
},
|
||||||
|
|
@ -65,13 +65,13 @@ pub(crate) enum Error {
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
Conflict(&'static str), // This is only needed for when a room alias already exists
|
Conflict(&'static str), // This is only needed for when a room alias already exists
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
ExtensionError(#[from] axum::extract::rejection::ExtensionRejection),
|
Extension(#[from] axum::extract::rejection::ExtensionRejection),
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
PathError(#[from] axum::extract::rejection::PathRejection),
|
Path(#[from] axum::extract::rejection::PathRejection),
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
AdminCommand(&'static str),
|
AdminCommand(&'static str),
|
||||||
#[error("from {0}: {1}")]
|
#[error("from {0}: {1}")]
|
||||||
RedactionError(OwnedServerName, ruma::canonical_json::RedactionError),
|
Redaction(OwnedServerName, ruma::canonical_json::RedactionError),
|
||||||
#[error("{0} in {1}")]
|
#[error("{0} in {1}")]
|
||||||
InconsistentRoomState(&'static str, ruma::OwnedRoomId),
|
InconsistentRoomState(&'static str, ruma::OwnedRoomId),
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ impl Error {
|
||||||
return RumaResponse(UiaaResponse::AuthResponse(uiaainfo.clone()));
|
return RumaResponse(UiaaResponse::AuthResponse(uiaainfo.clone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Self::FederationError(origin, error) = self {
|
if let Self::Federation(origin, error) = self {
|
||||||
let mut error = error.clone();
|
let mut error = error.clone();
|
||||||
error.body = ErrorBody::Standard {
|
error.body = ErrorBody::Standard {
|
||||||
kind: Unknown,
|
kind: Unknown,
|
||||||
|
|
@ -141,10 +141,10 @@ impl Error {
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "sqlite")]
|
#[cfg(feature = "sqlite")]
|
||||||
Self::SqliteError { .. } => db_error,
|
Self::Sqlite { .. } => db_error,
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
Self::RocksDbError { .. } => db_error,
|
Self::RocksDb { .. } => db_error,
|
||||||
Self::IoError { .. } => db_error,
|
Self::Io { .. } => db_error,
|
||||||
Self::BadConfig { .. } => db_error,
|
Self::BadConfig { .. } => db_error,
|
||||||
Self::BadDatabase { .. } => db_error,
|
Self::BadDatabase { .. } => db_error,
|
||||||
_ => self.to_string(),
|
_ => self.to_string(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue