-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Resolve new clippy lints from Rust 1.57 through 1.70 #263
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warning: this `impl` can be derived --> src/env.rs:10:1 | 10 | / impl Default for Update { 11 | | fn default() -> Self { 12 | | Update::Wip 13 | | } 14 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls = note: `#[warn(clippy::derivable_impls)]` on by default = help: remove the manual implementation... help: ...and instead derive it... | 5 + #[derive(Default)] 6 | pub(crate) enum Update { | help: ...and mark the default variant | 6 ~ #[default] 7 ~ Wip, | warning: this `impl` can be derived --> src/manifest.rs:78:1 | 78 | / impl Default for Edition { 79 | | fn default() -> Self { 80 | | Edition::E2015 81 | | } 82 | | } | |_^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls = note: `#[warn(clippy::derivable_impls)]` on by default = help: remove the manual implementation... help: ...and instead derive it... | 42 + #[derive(Default)] 43 | pub(crate) enum Edition { | help: ...and mark the default variant | 44 ~ #[default] 45 ~ E2015, |
warning: this could be rewritten as `let...else` --> src/env.rs:13:9 | 13 | / let var = match env::var_os("TRYBUILD") { 14 | | Some(var) => var, 15 | | None => return Ok(Update::default()), 16 | | }; | |__________^ help: consider writing: `let Some(var) = env::var_os("TRYBUILD") else { return Ok(Update::default()) };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]` warning: this could be rewritten as `let...else` --> src/flock.rs:118:9 | 118 | / let modified = match metadata.modified() { 119 | | Ok(modified) => modified, 120 | | Err(_) => return None, 121 | | }; | |__________^ help: consider writing: `let Ok(modified) = metadata.modified() else { return None };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]` warning: this could be rewritten as `let...else` --> src/normalize.rs:519:9 | 519 | / let next_line = match ahead.next() { 520 | | Some(line) => line, 521 | | None => continue, 522 | | }; | |__________^ help: consider writing: `let Some(next_line) = ahead.next() else { continue };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else warning: this could be rewritten as `let...else` --> src/run.rs:267:17 | 267 | / let dep_name = match en.strip_prefix("dep:") { 268 | | Some(dep_name) => dep_name, 269 | | None => return false, 270 | | }; | |__________________^ help: consider writing: `let Some(dep_name) = en.strip_prefix("dep:") else { return false };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else warning: this could be rewritten as `let...else` --> src/run.rs:625:9 | 625 | / let begin = match remaining.find("{\"reason\":") { 626 | | Some(begin) => begin, 627 | | None => break, 628 | | }; | |__________^ help: consider writing: `let Some(begin) = remaining.find("{\"reason\":") else { break };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else warning: this could be rewritten as `let...else` --> src/run.rs:646:17 | 646 | / let (name, test) = match path_map.get(&de.target.src_path) { 647 | | Some(test) => test, 648 | | None => continue, 649 | | }; | |__________________^ help: consider writing: `let Some((name, test)) = path_map.get(&de.target.src_path) else { continue };` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
warning: variables can be used directly in the `format!` string --> src/error.rs:36:25 | 36 | Cargo(e) => write!(f, "failed to execute cargo: {}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-W clippy::uninlined-format-args` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 36 - Cargo(e) => write!(f, "failed to execute cargo: {}", e), 36 + Cargo(e) => write!(f, "failed to execute cargo: {e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:39:24 | 39 | Glob(e) => write!(f, "{}", e), | ^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 39 - Glob(e) => write!(f, "{}", e), 39 + Glob(e) => write!(f, "{e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:40:22 | 40 | Io(e) => write!(f, "{}", e), | ^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 40 - Io(e) => write!(f, "{}", e), 40 + Io(e) => write!(f, "{e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:41:28 | 41 | Metadata(e) => write!(f, "failed to read cargo metadata: {}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 41 - Metadata(e) => write!(f, "failed to read cargo metadata: {}", e), 41 + Metadata(e) => write!(f, "failed to read cargo metadata: {e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:45:27 | 45 | Pattern(e) => write!(f, "{}", e), | ^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 45 - Pattern(e) => write!(f, "{}", e), 45 + Pattern(e) => write!(f, "{e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:47:30 | 47 | ReadStderr(e) => write!(f, "failed to read stderr file: {}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 47 - ReadStderr(e) => write!(f, "failed to read stderr file: {}", e), 47 + ReadStderr(e) => write!(f, "failed to read stderr file: {e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:52:26 | 52 | TomlDe(e) => write!(f, "{}", e), | ^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 52 - TomlDe(e) => write!(f, "{}", e), 52 + TomlDe(e) => write!(f, "{e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:53:27 | 53 | TomlSer(e) => write!(f, "{}", e), | ^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 53 - TomlSer(e) => write!(f, "{}", e), 53 + TomlSer(e) => write!(f, "{e}"), | warning: variables can be used directly in the `format!` string --> src/error.rs:59:31 | 59 | WriteStderr(e) => write!(f, "failed to write stderr file: {}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 59 - WriteStderr(e) => write!(f, "failed to write stderr file: {}", e), 59 + WriteStderr(e) => write!(f, "failed to write stderr file: {e}"), | warning: variables can be used directly in the `format!` string --> src/expand.rs:59:25 | 59 | let name = Name(format!("trybuild{:03}", index)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 59 - let name = Name(format!("trybuild{:03}", index)); 59 + let name = Name(format!("trybuild{index:03}")); | warning: variables can be used directly in the `format!` string --> src/normalize.rs:205:47 | 205 | ... let replacement = format!("$OUT_DIR[{}]", out_dir_crate_name); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 205 - let replacement = format!("$OUT_DIR[{}]", out_dir_crate_name); 205 + let replacement = format!("$OUT_DIR[{out_dir_crate_name}]"); | warning: variables can be used directly in the `format!` string --> src/run.rs:153:28 | 153 | let project_name = format!("{}-tests", crate_name); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 153 - let project_name = format!("{}-tests", crate_name); 153 + let project_name = format!("{crate_name}-tests"); | warning: variables can be used directly in the `format!` string --> src/run.rs:283:35 | 283 | enables.insert(0, format!("{}/{}", crate_name, feature)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 283 - enables.insert(0, format!("{}/{}", crate_name, feature)); 283 + enables.insert(0, format!("{crate_name}/{feature}")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Followup to #262.