From e9a734c1b1944e2309afb3caa68eff633d41103f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Jul 2022 22:06:04 -0700 Subject: [PATCH] Ignore assertions_on_result_states clippy lint error: called `assert!` with `Result::is_err` --> tests/comments.rs:68:5 | 68 | assert!("/*/".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"/*/".parse::().unwrap_err()` | = note: `-D clippy::assertions-on-result-states` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:224:5 | 224 | assert!("1".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"1".parse::().unwrap()` | = note: `-D clippy::assertions-on-result-states` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:225:5 | 225 | assert!("-1".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"-1".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:226:5 | 226 | assert!("-1u12".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"-1u12".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:227:5 | 227 | assert!("1.0".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"1.0".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:228:5 | 228 | assert!("-1.0".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"-1.0".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:229:5 | 229 | assert!("-1.0f12".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"-1.0f12".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:230:5 | 230 | assert!("'a'".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"'a'".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_ok` --> tests/test.rs:231:5 | 231 | assert!("\"\n\"".parse::().is_ok()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"\"\n\"".parse::().unwrap()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:232:5 | 232 | assert!("0 1".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"0 1".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:233:5 | 233 | assert!(" 0".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `" 0".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:234:5 | 234 | assert!("0 ".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"0 ".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:235:5 | 235 | assert!("/* comment */0".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"/* comment */0".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:236:5 | 236 | assert!("0/* comment */".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"0/* comment */".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:237:5 | 237 | assert!("0// comment".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"0// comment".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:238:5 | 238 | assert!("- 1".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"- 1".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:239:5 | 239 | assert!("- 1.0".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"- 1.0".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:240:5 | 240 | assert!("-\"\"".parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `"-\"\"".parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states error: called `assert!` with `Result::is_err` --> tests/test.rs:385:5 | 385 | assert!(s.parse::().is_err()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `s.parse::().unwrap_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states --- tests/comments.rs | 2 ++ tests/test.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/comments.rs b/tests/comments.rs index 71741080..4f7236de 100644 --- a/tests/comments.rs +++ b/tests/comments.rs @@ -1,3 +1,5 @@ +#![allow(clippy::assertions_on_result_states)] + use proc_macro2::{Delimiter, Literal, Spacing, TokenStream, TokenTree}; // #[doc = "..."] -> "..." diff --git a/tests/test.rs b/tests/test.rs index 31d9a8df..16f775ed 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,4 +1,4 @@ -#![allow(clippy::non_ascii_literal)] +#![allow(clippy::assertions_on_result_states, clippy::non_ascii_literal)] use proc_macro2::{Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree}; use std::panic;