Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuoTiJia committed Nov 21, 2023
1 parent 4a0d2c0 commit ad640cf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions common/protocol_parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -294,7 +294,7 @@ fn next_field_set(buf: &str) -> Result<Option<(FieldSet, usize)>> {

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;
Expand Down
4 changes: 2 additions & 2 deletions main/src/http/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand All @@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion main/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum Error {

#[snafu(display("gerante pprof files: {}", reason))]
#[error_code(code = 9)]
PProfError {
PProf {
reason: String,
},

Expand Down
8 changes: 4 additions & 4 deletions main/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ 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 },
}

impl From<tonic::transport::Error> for Error {
fn from(_: tonic::transport::Error) -> Self {
Self::IdentityFormatError
Self::IdentityFormat
}
}

impl From<std::io::Error> for Error {
fn from(_: std::io::Error) -> Self {
Self::TLSConfigError
Self::TLSConfig
}
}

Expand Down
2 changes: 1 addition & 1 deletion tskv/src/file_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub fn get_file_id_range(dir: impl AsRef<Path>, 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 {
Expand Down

0 comments on commit ad640cf

Please sign in to comment.