• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

heathcliff26 / cerberus-mergeguard / 16003644143

01 Jul 2025 03:28PM UTC coverage: 65.377%. Remained the same
16003644143

push

github

heathcliff26
Fix lint error after rust upgrade

The new clippy upgrade finds new lint errors.
Fix the given errors.

Signed-off-by: Heathcliff <heathcliff@heathcliff.eu>

0 of 3 new or added lines in 3 files covered. (0.0%)

625 of 956 relevant lines covered (65.38%)

2.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/error.rs
1
use std::fmt::Display;
2

3
/// Error type for the application, encapsulating various error scenarios
4
#[derive(Debug)]
5
pub enum Error {
6
    ReadPrivateKey(String, std::io::Error),
7
    EncodingKey(jsonwebtoken::errors::Error),
8
    #[allow(clippy::upper_case_acronyms)]
9
    JWT(jsonwebtoken::errors::Error),
10
    InvalidBearerToken(),
11
    CreateRequest(reqwest::Error),
12
    Send(reqwest::Error),
13
    NonOkStatus(String, reqwest::StatusCode),
14
    Parse(&'static str, Box<dyn std::error::Error>),
15
    ReceiveBody(reqwest::Error),
16
    Serve(std::io::Error),
17
    BindPort(Box<dyn std::error::Error>),
18
    ReadConfigFile(String, std::io::Error),
19
    ParseConfigFile(String, serde_yaml::Error),
20
    InvalidConfig(&'static str),
21
}
22

23
impl Display for Error {
24
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
×
25
        match self {
×
26
            Error::ReadPrivateKey(path, err) => {
×
27
                write!(f, "Failed to read private key '{path}': {err}")
×
28
            }
29
            Error::EncodingKey(err) => {
×
30
                write!(f, "Failed to create encoding key: {err}")
×
31
            }
32
            Error::JWT(err) => {
×
33
                write!(f, "Failed to create JWT token: {err}")
×
34
            }
35
            Error::InvalidBearerToken() => {
36
                write!(f, "Invalid bearer token provided.")
×
37
            }
38
            Error::CreateRequest(err) => {
×
39
                write!(f, "Failed to create request: {err}")
×
40
            }
41
            Error::Send(err) => {
×
42
                write!(f, "Failed to send request: {}", full_error_stack(err))
×
43
            }
44
            Error::NonOkStatus(url, status) => {
×
45
                write!(f, "Request to '{url}' failed with status: {status}")
×
46
            }
47
            Error::Parse(url, err) => {
×
48
                write!(f, "Failed to parse response from '{url}': {err}")
×
49
            }
50
            Error::ReceiveBody(err) => {
×
51
                write!(f, "Failed to read response body: {err}")
×
52
            }
53
            Error::Serve(err) => {
×
54
                write!(f, "Server error: {err}")
×
55
            }
56
            Error::BindPort(err) => {
×
57
                write!(f, "Failed to bind port: {err}")
×
58
            }
59
            Error::ReadConfigFile(path, err) => {
×
60
                write!(f, "Failed to read config file '{path}': {err}")
×
61
            }
62
            Error::ParseConfigFile(path, err) => {
×
63
                write!(f, "Failed to parse config file '{path}': {err}")
×
64
            }
65
            Error::InvalidConfig(msg) => {
×
66
                write!(f, "Invalid configuration: {msg}")
×
67
            }
68
        }
69
    }
×
70
}
71

72
impl std::error::Error for Error {}
73

74
fn full_error_stack(mut e: &dyn std::error::Error) -> String {
×
75
    let mut s = format!("{e}");
×
76
    while let Some(src) = e.source() {
×
NEW
77
        s.push_str(&format!(": {src}"));
×
78
        e = src;
×
79
    }
×
80
    s
×
81
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc