Skip to content

Commit

Permalink
Resolve needless_raw_string_hashes pedantic clippy lint in test
Browse files Browse the repository at this point in the history
    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2313:16
         |
    2313 |     assert_eq!(r#"42"#, array_from_str[1].get());
         |                ^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
         = note: `-W clippy::needless-raw-string-hashes` implied by `-W clippy::pedantic`
         = help: to override `-W clippy::pedantic` add `#[allow(clippy::needless_raw_string_hashes)]`
    help: remove all the hashes around the string literal
         |
    2313 -     assert_eq!(r#"42"#, array_from_str[1].get());
    2313 +     assert_eq!(r"42", array_from_str[1].get());
         |

    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2315:16
         |
    2315 |     assert_eq!(r#"null"#, array_from_str[3].get());
         |                ^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the string literal
         |
    2315 -     assert_eq!(r#"null"#, array_from_str[3].get());
    2315 +     assert_eq!(r"null", array_from_str[3].get());
         |

    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2392:16
         |
    2392 |     assert_eq!(r#"42"#, array_from_str[1].get());
         |                ^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the string literal
         |
    2392 -     assert_eq!(r#"42"#, array_from_str[1].get());
    2392 +     assert_eq!(r"42", array_from_str[1].get());
         |

    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2394:16
         |
    2394 |     assert_eq!(r#"null"#, array_from_str[3].get());
         |                ^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the string literal
         |
    2394 -     assert_eq!(r#"null"#, array_from_str[3].get());
    2394 +     assert_eq!(r"null", array_from_str[3].get());
         |

    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2399:16
         |
    2399 |     assert_eq!(r#"42"#, array_from_reader[1].get());
         |                ^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the string literal
         |
    2399 -     assert_eq!(r#"42"#, array_from_reader[1].get());
    2399 +     assert_eq!(r"42", array_from_reader[1].get());
         |

    warning: unnecessary hashes around raw string literal
        --> tests/test.rs:2401:16
         |
    2401 |     assert_eq!(r#"null"#, array_from_reader[3].get());
         |                ^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
    help: remove all the hashes around the string literal
         |
    2401 -     assert_eq!(r#"null"#, array_from_reader[3].get());
    2401 +     assert_eq!(r"null", array_from_reader[3].get());
         |
  • Loading branch information
dtolnay committed Jun 2, 2024
1 parent 62839b7 commit 18e9b89
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2311,9 +2311,9 @@ fn test_borrowed_raw_value() {
let array_from_str: Vec<&RawValue> =
serde_json::from_str(r#"["a", 42, {"foo": "bar"}, null]"#).unwrap();
assert_eq!(r#""a""#, array_from_str[0].get());
assert_eq!(r#"42"#, array_from_str[1].get());
assert_eq!("42", array_from_str[1].get());
assert_eq!(r#"{"foo": "bar"}"#, array_from_str[2].get());
assert_eq!(r#"null"#, array_from_str[3].get());
assert_eq!("null", array_from_str[3].get());

let array_to_string = serde_json::to_string(&array_from_str).unwrap();
assert_eq!(r#"["a",42,{"foo": "bar"},null]"#, array_to_string);
Expand Down Expand Up @@ -2390,16 +2390,16 @@ fn test_boxed_raw_value() {
let array_from_str: Vec<Box<RawValue>> =
serde_json::from_str(r#"["a", 42, {"foo": "bar"}, null]"#).unwrap();
assert_eq!(r#""a""#, array_from_str[0].get());
assert_eq!(r#"42"#, array_from_str[1].get());
assert_eq!("42", array_from_str[1].get());
assert_eq!(r#"{"foo": "bar"}"#, array_from_str[2].get());
assert_eq!(r#"null"#, array_from_str[3].get());
assert_eq!("null", array_from_str[3].get());

let array_from_reader: Vec<Box<RawValue>> =
serde_json::from_reader(br#"["a", 42, {"foo": "bar"}, null]"#.as_ref()).unwrap();
assert_eq!(r#""a""#, array_from_reader[0].get());
assert_eq!(r#"42"#, array_from_reader[1].get());
assert_eq!("42", array_from_reader[1].get());
assert_eq!(r#"{"foo": "bar"}"#, array_from_reader[2].get());
assert_eq!(r#"null"#, array_from_reader[3].get());
assert_eq!("null", array_from_reader[3].get());

let array_to_string = serde_json::to_string(&array_from_str).unwrap();
assert_eq!(r#"["a",42,{"foo": "bar"},null]"#, array_to_string);
Expand Down

0 comments on commit 18e9b89

Please sign in to comment.