Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bolt-boost): add self lints #425

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bolt-boost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ lazy_static = "1.5.0"
# NOTE: we need this in order to play nice with Lighthouse types at version 5.3.0
ssz_compat = { version = "0.5", package = "ethereum_ssz" }
types = { git = "https://github.com/sigp/lighthouse", tag = "v5.3.0" }

[lints.clippy]
unnecessary_self_imports = "warn"
use_self = "warn"
12 changes: 6 additions & 6 deletions bolt-boost/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ pub enum PbsClientError {
impl PbsClientError {
pub fn status_code(&self) -> StatusCode {
match self {
PbsClientError::NoResponse => StatusCode::SERVICE_UNAVAILABLE,
PbsClientError::NoPayload => StatusCode::BAD_GATEWAY,
PbsClientError::BadRequest => StatusCode::BAD_REQUEST,
Self::NoResponse => StatusCode::SERVICE_UNAVAILABLE,
Self::NoPayload => StatusCode::BAD_GATEWAY,
Self::BadRequest => StatusCode::BAD_REQUEST,
}
}
}

impl IntoResponse for PbsClientError {
fn into_response(self) -> axum::response::Response {
let msg = match self {
PbsClientError::NoResponse => "no response from relays",
PbsClientError::NoPayload => "no payload from relays",
PbsClientError::BadRequest => "bad request",
Self::NoResponse => "no response from relays",
Self::NoPayload => "no payload from relays",
Self::BadRequest => "bad request",
};

(self.status_code(), msg).into_response()
Expand Down