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

[Xline] Variables can be used directly in the format! string #120

Closed
Phoenix500526 opened this issue Dec 28, 2022 · 0 comments
Closed

[Xline] Variables can be used directly in the format! string #120

Phoenix500526 opened this issue Dec 28, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@Phoenix500526
Copy link
Collaborator

Inline variables in a format string and eliminate these warnings.

cargo clippy
    Checking curp v0.1.0 (/home/jiawei/Xline/curp)
error: variables can be used directly in the `format!` string
   --> curp/src/client.rs:252:58
    |
252 |                     return Err(ProposeError::SyncedError(format!("{:?}", e)));
    |                                                          ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
note: the lint level is defined here
   --> curp/src/lib.rs:44:5
    |
44  |     clippy::pedantic,
    |     ^^^^^^^^^^^^^^^^
    = note: `#[deny(clippy::uninlined_format_args)]` implied by `#[deny(clippy::pedantic)]`
help: change this to
    |
252 -                     return Err(ProposeError::SyncedError(format!("{:?}", e)));
252 +                     return Err(ProposeError::SyncedError(format!("{e:?}")));
    |

error: variables can be used directly in the `format!` string
   --> curp/src/server/mod.rs:167:17
    |
167 |                 format!("0.0.0.0:{}", port)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
167 -                 format!("0.0.0.0:{}", port)
167 +                 format!("0.0.0.0:{port}")
    |

error: variables can be used directly in the `format!` string
   --> curp/src/server/mod.rs:169:60
    |
169 |                     .map_err(|e| ServerError::ParsingError(format!("{}", e)))?,
    |                                                            ^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
169 -                     .map_err(|e| ServerError::ParsingError(format!("{}", e)))?,
169 +                     .map_err(|e| ServerError::ParsingError(format!("{e}")))?,
    |

error: variables can be used directly in the `format!` string
   --> curp/src/server/mod.rs:403:45
    |
403 |             tonic::Status::invalid_argument(format!("propose cmd decode failed: {}", e))
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
403 -             tonic::Status::invalid_argument(format!("propose cmd decode failed: {}", e))
403 +             tonic::Status::invalid_argument(format!("propose cmd decode failed: {e}"))
    |

error: variables can be used directly in the `format!` string
   --> curp/src/server/mod.rs:483:45
    |
483 |             tonic::Status::invalid_argument(format!("wait_synced id decode failed: {}", e))
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
483 -             tonic::Status::invalid_argument(format!("wait_synced id decode failed: {}", e))
483 +             tonic::Status::invalid_argument(format!("wait_synced id decode failed: {e}"))
    |

error: variables can be used directly in the `format!` string
   --> curp/src/server/mod.rs:584:50
    |
584 |             .map_err(|e| tonic::Status::internal(format!("encode or decode error, {}", e)))?;
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
584 -             .map_err(|e| tonic::Status::internal(format!("encode or decode error, {}", e)))?;
584 +             .map_err(|e| tonic::Status::internal(format!("encode or decode error, {e}")))?;
    |

error: could not compile `curp` due to 6 previous errors
@Phoenix500526 Phoenix500526 added the good first issue Good for newcomers label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant