Skip to content

Commit

Permalink
Merge pull request #425 from chainbound/self-lint-boost
Browse files Browse the repository at this point in the history
chore(bolt-boost): add self lints
  • Loading branch information
merklefruit authored Nov 26, 2024
2 parents 19aba4a + d213c18 commit d3363ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit d3363ea

Please sign in to comment.