diff --git a/common/protocol_parser/src/lib.rs b/common/protocol_parser/src/lib.rs index 6708d277bf..a9fe590758 100644 --- a/common/protocol_parser/src/lib.rs +++ b/common/protocol_parser/src/lib.rs @@ -119,7 +119,7 @@ fn next_measurement(buf: &str) -> Option<(&str, usize)> { let mut exists_measurement = false; let (mut tok_begin, mut tok_end) = (0, buf.len()); let mut i = 0; - for (_, c) in buf.chars().enumerate() { + for c in buf.chars() { // Measurement begin character if c == '\\' { escaped = true; @@ -161,7 +161,7 @@ fn next_metric(buf: &str) -> Option<(&str, usize)> { let mut exists_metric = false; let (mut tok_begin, mut tok_end) = (0, buf.len()); let mut i = 0; - for (_, c) in buf.chars().enumerate() { + for c in buf.chars() { // Measurement begin character if c == '\\' { escaped = true; @@ -210,7 +210,7 @@ fn next_tag_set(buf: &str) -> NextTagRes { let mut tag_set: Vec<(&str, &str)> = Vec::new(); let mut i = 0; - for (_, c) in buf.chars().enumerate() { + for c in buf.chars() { // TagSet begin character if !escaped && c == '\\' { escaped = true; @@ -294,7 +294,7 @@ fn next_field_set(buf: &str) -> Result> { let mut field_set: FieldSet = Vec::new(); let mut i = 0; - for (_, c) in buf.chars().enumerate() { + for c in buf.chars() { // TagSet begin character if c == '\\' { escaped = true; diff --git a/main/src/http/http_service.rs b/main/src/http/http_service.rs index 284444f8e2..fa07d0af02 100644 --- a/main/src/http/http_service.rs +++ b/main/src/http/http_service.rs @@ -668,7 +668,7 @@ impl HttpService { info!("debug pprof: {:?}", res); match res { Ok(v) => Ok(v), - Err(e) => Err(reject::custom(HttpError::PProfError { reason: e })), + Err(e) => Err(reject::custom(HttpError::PProf { reason: e })), } } #[cfg(not(unix))] @@ -688,7 +688,7 @@ impl HttpService { info!("debug jeprof: {:?}", res); match res { Ok(v) => Ok(v), - Err(e) => Err(reject::custom(HttpError::PProfError { reason: e })), + Err(e) => Err(reject::custom(HttpError::PProf { reason: e })), } } #[cfg(not(unix))] diff --git a/main/src/http/mod.rs b/main/src/http/mod.rs index 0cb3cb6d22..4de14e0edd 100644 --- a/main/src/http/mod.rs +++ b/main/src/http/mod.rs @@ -70,7 +70,7 @@ pub enum Error { #[snafu(display("gerante pprof files: {}", reason))] #[error_code(code = 9)] - PProfError { + PProf { reason: String, }, diff --git a/main/src/server.rs b/main/src/server.rs index 2da8efe635..034c532a20 100644 --- a/main/src/server.rs +++ b/main/src/server.rs @@ -37,10 +37,10 @@ pub enum Error { NotFoundDBMS { backtrace: Backtrace }, #[snafu(display("Ensure the format of certificate and private_key is correct."))] - IdentityFormatError, + IdentityFormat, #[snafu(display("Ensure the TLS configuration is correct"))] - TLSConfigError, + TLSConfig, #[snafu(display("Server Common Error : {}", reason))] Common { reason: String }, @@ -48,13 +48,13 @@ pub enum Error { impl From for Error { fn from(_: tonic::transport::Error) -> Self { - Self::IdentityFormatError + Self::IdentityFormat } } impl From for Error { fn from(_: std::io::Error) -> Self { - Self::TLSConfigError + Self::TLSConfig } } diff --git a/tskv/src/file_utils.rs b/tskv/src/file_utils.rs index a29bac5a82..f51ab06a5b 100644 --- a/tskv/src/file_utils.rs +++ b/tskv/src/file_utils.rs @@ -227,7 +227,7 @@ pub fn get_file_id_range(dir: impl AsRef, suffix: &str) -> Option<(u64, u6 let mut max_id = 0; let mut min_id = u64::MAX; let mut is_found = false; - for (_i, file_name) in file_names.iter().enumerate() { + for file_name in file_names.iter() { if let Ok(id) = get_file_id(file_name) { is_found = true; if max_id < id {