这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix inline arguments for println! and format! #82

@Angelmmiguel

Description

@Angelmmiguel

After upgrading to the latest version of Rust and clippy, I'm getting the following warning in println! and format! statements:

error: variables can be used directly in the `format!` string
  --> src/runtimes/metadata.rs:39:13
   |
39 |             println!("Err: {:?}", err);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
   |
39 -             println!("Err: {:?}", err);
39 +             println!("Err: {err:?}");
   |

This comes from a new linter rule that was introduced in Rust 1.66: uninlined format args. The warning is an error in the example as we're forcing this via parameters (cargo clippy -- -D warnings). The fix is quite simple and the code is more readable when adding the arguments inline.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions