658 Commits

Author SHA1 Message Date
David Tolnay
dbb909136e
Replace #[start] with extern fn main 2024-12-20 04:20:26 -08:00
David Tolnay
b9dbfcb4ac
Switch out fnv in favor of foldhash in test 2024-11-16 12:24:05 -08:00
David Tolnay
c270e27a4d
Use BuildHasher instead of Hasher in collection macros 2024-11-16 12:23:34 -08:00
David Tolnay
fa5d58cd00
Use ui test syntax that does not interfere with rustfmt 2024-11-10 23:50:37 -08:00
David Tolnay
1a3cf4b3c1
Update PR 2562 ui tests 2024-11-10 23:46:31 -08:00
David Tolnay
111ecc5d8c
Update ui tests for warning on colliding aliases 2024-11-10 23:31:55 -08:00
Mingun
5f9fffa53e Add checks for conflicts for aliases
- Check that alias is not the same as name of other field (it still can be the name of owning field/variant)
- Check that aliases are unique, i. e. two different fields does not use the same alias
2024-10-25 19:18:31 +05:00
David Tolnay
79925ac394
Ignore dead_code warning in regression test
warning: field `0` is never read
      --> test_suite/tests/regression/issue2846.rs:8:45
       |
    8  |         pub struct S(#[serde(with = $with)] i32);
       |                    - field in this struct   ^^^
    ...
    12 | declare_in_macro!("with");
       | ------------------------- in this macro invocation
       |
       = help: consider removing this field
       = note: `#[warn(dead_code)]` on by default
       = note: this warning originates in the macro `declare_in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
2024-10-22 11:10:52 -07:00
David Tolnay
fdc36e5c06
Add regression test for issue 2846
error[E0425]: cannot find value `__e` in this scope
      --> test_suite/tests/regression/issue2846.rs:12:19
       |
    12 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope
2024-10-22 11:08:22 -07:00
David Tolnay
49e11ce1ba
Ignore trivially_copy_pass_by_ref pedantic clippy lint in test
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
      --> test_suite/tests/regression/issue2844.rs:18:28
       |
    18 |     pub fn serialize<S>(_: &i32, _: S) -> Result<S::Ok, S::Error>
       |                            ^^^^ help: consider passing by value instead: `i32`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
       = note: `-W clippy::trivially-copy-pass-by-ref` implied by `-W clippy::pedantic`
       = help: to override `-W clippy::pedantic` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
2024-10-22 09:56:12 -07:00
David Tolnay
1e36ef551d
Fix hygiene of macro-generated local variable accesses in serde(with) wrappers 2024-10-22 09:38:06 -07:00
David Tolnay
0058c7226e
Add regression test for issue 2844
error[E0424]: expected value, found module `self`
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    5  |         #[derive(Serialize, Deserialize)]
       |                  --------- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
    ...
    13 | declare_in_macro!("with");
       |                   ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter

    error[E0425]: cannot find value `__s` in this scope
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    13 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope

    error[E0425]: cannot find value `__deserializer` in this scope
      --> test_suite/tests/regression/issue2844.rs:13:19
       |
    13 | declare_in_macro!("with");
       |                   ^^^^^^ not found in this scope
2024-10-22 09:37:58 -07:00
David Tolnay
29d4f3e887
Format regression tests with rustfmt 2024-10-22 09:28:10 -07:00
David Tolnay
00460b8dee
Fix wording in comments from PR 2558 2024-10-21 21:07:13 -07:00
David Tolnay
d4486be2b9
Format all ui tests from PR 2558 using rustfmt 2024-10-21 19:43:45 -07:00
David Tolnay
53ade10137
Update ui tests from PR 2558 2024-10-21 18:52:49 -07:00
Oli Scherer
3415619bfd
Merge pull request #2566 from Mingun/variant-aliases
Show variant aliases in error message
2024-10-21 21:40:57 +02:00
Oli Scherer
04bb76bc00
Merge pull request #2558 from Mingun/correct-span
Improve error reporting about mismatched signature in `with` and `default` attributes
2024-10-21 21:38:09 +02:00
David Tolnay
4b3178b053
Ignore needless_lifetimes clippy lint
warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:124:6
        |
    124 | impl<'de, E> IntoDeserializer<'de, E> for ()
        |      ^^^                      ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
        = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]`
    help: elide the lifetimes
        |
    124 - impl<'de, E> IntoDeserializer<'de, E> for ()
    124 + impl<E> IntoDeserializer<'_, E> for ()
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:196:6
        |
    196 | impl<'de, E> IntoDeserializer<'de, E> for !
        |      ^^^                      ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    196 - impl<'de, E> IntoDeserializer<'de, E> for !
    196 + impl<E> IntoDeserializer<'_, E> for !
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:317:6
        |
    317 | impl<'de, E> IntoDeserializer<'de, E> for u32
        |      ^^^                      ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    317 - impl<'de, E> IntoDeserializer<'de, E> for u32
    317 + impl<E> IntoDeserializer<'_, E> for u32
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:406:6
        |
    406 | impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a str
        |      ^^^                          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    406 - impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a str
    406 + impl<'a, E> IntoDeserializer<'_, E> for &'a str
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:427:11
        |
    427 | impl<'de, 'a, E> de::Deserializer<'de> for StrDeserializer<'a, E>
        |           ^^                                               ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    427 - impl<'de, 'a, E> de::Deserializer<'de> for StrDeserializer<'a, E>
    427 + impl<'de, E> de::Deserializer<'de> for StrDeserializer<'_, E>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:461:11
        |
    461 | impl<'de, 'a, E> de::EnumAccess<'de> for StrDeserializer<'a, E>
        |           ^^                                             ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    461 - impl<'de, 'a, E> de::EnumAccess<'de> for StrDeserializer<'a, E>
    461 + impl<'de, E> de::EnumAccess<'de> for StrDeserializer<'_, E>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:476:6
        |
    476 | impl<'a, E> Debug for StrDeserializer<'a, E> {
        |      ^^                               ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    476 - impl<'a, E> Debug for StrDeserializer<'a, E> {
    476 + impl<E> Debug for StrDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:555:6
        |
    555 | impl<'de, E> Debug for BorrowedStrDeserializer<'de, E> {
        |      ^^^                                       ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    555 - impl<'de, E> Debug for BorrowedStrDeserializer<'de, E> {
    555 + impl<E> Debug for BorrowedStrDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:586:6
        |
    586 | impl<'de, E> IntoDeserializer<'de, E> for String
        |      ^^^                      ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    586 - impl<'de, E> IntoDeserializer<'de, E> for String
    586 + impl<E> IntoDeserializer<'_, E> for String
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:680:6
        |
    680 | impl<'a, E> Clone for CowStrDeserializer<'a, E> {
        |      ^^                                  ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    680 - impl<'a, E> Clone for CowStrDeserializer<'a, E> {
    680 + impl<E> Clone for CowStrDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:691:6
        |
    691 | impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str>
        |      ^^^                          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    691 - impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str>
    691 + impl<'a, E> IntoDeserializer<'_, E> for Cow<'a, str>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:714:11
        |
    714 | impl<'de, 'a, E> de::Deserializer<'de> for CowStrDeserializer<'a, E>
        |           ^^                                                  ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    714 - impl<'de, 'a, E> de::Deserializer<'de> for CowStrDeserializer<'a, E>
    714 + impl<'de, E> de::Deserializer<'de> for CowStrDeserializer<'_, E>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:752:11
        |
    752 | impl<'de, 'a, E> de::EnumAccess<'de> for CowStrDeserializer<'a, E>
        |           ^^                                                ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    752 - impl<'de, 'a, E> de::EnumAccess<'de> for CowStrDeserializer<'a, E>
    752 + impl<'de, E> de::EnumAccess<'de> for CowStrDeserializer<'_, E>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:768:6
        |
    768 | impl<'a, E> Debug for CowStrDeserializer<'a, E> {
        |      ^^                                  ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    768 - impl<'a, E> Debug for CowStrDeserializer<'a, E> {
    768 + impl<E> Debug for CowStrDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:797:6
        |
    797 | impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a [u8]
        |      ^^^                          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    797 - impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a [u8]
    797 + impl<'a, E> IntoDeserializer<'_, E> for &'a [u8]
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:808:11
        |
    808 | impl<'de, 'a, E> Deserializer<'de> for BytesDeserializer<'a, E>
        |           ^^                                             ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    808 - impl<'de, 'a, E> Deserializer<'de> for BytesDeserializer<'a, E>
    808 + impl<'de, E> Deserializer<'de> for BytesDeserializer<'_, E>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/value.rs:828:6
        |
    828 | impl<'a, E> Debug for BytesDeserializer<'a, E> {
        |      ^^                                 ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    828 - impl<'a, E> Debug for BytesDeserializer<'a, E> {
    828 + impl<E> Debug for BytesDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/value.rs:876:6
        |
    876 | impl<'de, E> Debug for BorrowedBytesDeserializer<'de, E> {
        |      ^^^                                         ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    876 - impl<'de, E> Debug for BorrowedBytesDeserializer<'de, E> {
    876 + impl<E> Debug for BorrowedBytesDeserializer<'_, E> {
        |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/value.rs:1101:6
         |
    1101 | impl<'de, I, E> MapDeserializer<'de, I, E>
         |      ^^^                        ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1101 - impl<'de, I, E> MapDeserializer<'de, I, E>
    1101 + impl<I, E> MapDeserializer<'_, I, E>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/value.rs:1118:6
         |
    1118 | impl<'de, I, E> MapDeserializer<'de, I, E>
         |      ^^^                        ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1118 - impl<'de, I, E> MapDeserializer<'de, I, E>
    1118 + impl<I, E> MapDeserializer<'_, I, E>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/value.rs:1141:6
         |
    1141 | impl<'de, I, E> MapDeserializer<'de, I, E>
         |      ^^^                        ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1141 - impl<'de, I, E> MapDeserializer<'de, I, E>
    1141 + impl<I, E> MapDeserializer<'_, I, E>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/value.rs:1287:6
         |
    1287 | impl<'de, I, E> Clone for MapDeserializer<'de, I, E>
         |      ^^^                                  ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1287 - impl<'de, I, E> Clone for MapDeserializer<'de, I, E>
    1287 + impl<I, E> Clone for MapDeserializer<'_, I, E>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/value.rs:1304:6
         |
    1304 | impl<'de, I, E> Debug for MapDeserializer<'de, I, E>
         |      ^^^                                  ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1304 - impl<'de, I, E> Debug for MapDeserializer<'de, I, E>
    1304 + impl<I, E> Debug for MapDeserializer<'_, I, E>
         |

    warning: the following explicit lifetimes could be elided: 'de
      --> serde/src/de/impls.rs:17:6
       |
    17 | impl<'de> Visitor<'de> for UnitVisitor {
       |      ^^^          ^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
       |
    17 - impl<'de> Visitor<'de> for UnitVisitor {
    17 + impl Visitor<'_> for UnitVisitor {
       |

    warning: the following explicit lifetimes could be elided: 'de
      --> serde/src/de/impls.rs:56:6
       |
    56 | impl<'de> Visitor<'de> for BoolVisitor {
       |      ^^^          ^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
       |
    56 - impl<'de> Visitor<'de> for BoolVisitor {
    56 + impl Visitor<'_> for BoolVisitor {
       |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/impls.rs:550:6
        |
    550 | impl<'de> Visitor<'de> for CharVisitor {
        |      ^^^          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    550 - impl<'de> Visitor<'de> for CharVisitor {
    550 + impl Visitor<'_> for CharVisitor {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/impls.rs:596:6
        |
    596 | impl<'de> Visitor<'de> for StringVisitor {
        |      ^^^          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    596 - impl<'de> Visitor<'de> for StringVisitor {
    596 + impl Visitor<'_> for StringVisitor {
        |

    warning: the following explicit lifetimes could be elided: 'de, 'a
       --> serde/src/de/impls.rs:642:6
        |
    642 | impl<'a, 'de> Visitor<'de> for StringInPlaceVisitor<'a> {
        |      ^^  ^^^          ^^^                           ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    642 - impl<'a, 'de> Visitor<'de> for StringInPlaceVisitor<'a> {
    642 + impl Visitor<'_> for StringInPlaceVisitor<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/de/impls.rs:953:6
        |
    953 | impl<'de, T> Visitor<'de> for PhantomDataVisitor<T>
        |      ^^^             ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    953 - impl<'de, T> Visitor<'de> for PhantomDataVisitor<T>
    953 + impl<T> Visitor<'_> for PhantomDataVisitor<T>
        |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/de/impls.rs:1195:14
         |
    1195 |         impl<'a, 'de, T> Visitor<'de> for VecInPlaceVisitor<'a, T>
         |              ^^                                             ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1195 -         impl<'a, 'de, T> Visitor<'de> for VecInPlaceVisitor<'a, T>
    1195 +         impl<'de, T> Visitor<'de> for VecInPlaceVisitor<'_, T>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:1838:6
         |
    1838 | impl<'de> Visitor<'de> for PathBufVisitor {
         |      ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1838 - impl<'de> Visitor<'de> for PathBufVisitor {
    1838 + impl Visitor<'_> for PathBufVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/de/impls.rs:1991:11
         |
    1991 | impl<'de, 'a, T> Deserialize<'de> for Cow<'a, T>
         |           ^^                              ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1991 - impl<'de, 'a, T> Deserialize<'de> for Cow<'a, T>
    1991 + impl<'de, T> Deserialize<'de> for Cow<'_, T>
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2161:22
         |
    2161 |                 impl<'de> Visitor<'de> for FieldVisitor {
         |                      ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2161 -                 impl<'de> Visitor<'de> for FieldVisitor {
    2161 +                 impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2300:22
         |
    2300 |                 impl<'de> Visitor<'de> for FieldVisitor {
         |                      ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2300 -                 impl<'de> Visitor<'de> for FieldVisitor {
    2300 +                 impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2501:18
         |
    2501 |             impl<'de> Visitor<'de> for FieldVisitor {
         |                  ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2501 -             impl<'de> Visitor<'de> for FieldVisitor {
    2501 +             impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2658:18
         |
    2658 |             impl<'de> Visitor<'de> for FieldVisitor {
         |                  ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2658 -             impl<'de> Visitor<'de> for FieldVisitor {
    2658 +             impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2796:18
         |
    2796 |             impl<'de> Visitor<'de> for FieldVisitor {
         |                  ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2796 -             impl<'de> Visitor<'de> for FieldVisitor {
    2796 +             impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:2907:22
         |
    2907 |                 impl<'de> Visitor<'de> for FieldVisitor {
         |                      ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2907 -                 impl<'de> Visitor<'de> for FieldVisitor {
    2907 +                 impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:3018:22
         |
    3018 |                 impl<'de> Visitor<'de> for FieldVisitor {
         |                      ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    3018 -                 impl<'de> Visitor<'de> for FieldVisitor {
    3018 +                 impl Visitor<'_> for FieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/de/impls.rs:3166:6
         |
    3166 | impl<'de, T> Visitor<'de> for FromStrVisitor<T>
         |      ^^^             ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    3166 - impl<'de, T> Visitor<'de> for FromStrVisitor<T>
    3166 + impl<T> Visitor<'_> for FromStrVisitor<T>
         |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde/src/de/mod.rs:397:6
        |
    397 | impl<'a> fmt::Display for Unexpected<'a> {
        |      ^^                              ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    397 - impl<'a> fmt::Display for Unexpected<'a> {
    397 + impl fmt::Display for Unexpected<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'f, 'a
        --> serde/src/de/mod.rs:2309:14
         |
    2309 |         impl<'f, 'a> fmt::Write for LookForDecimalPoint<'f, 'a> {
         |              ^^  ^^                                     ^^  ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2309 -         impl<'f, 'a> fmt::Write for LookForDecimalPoint<'f, 'a> {
    2309 +         impl fmt::Write for LookForDecimalPoint<'_, '_> {
         |

    warning: the following explicit lifetimes could be elided: 'a
      --> serde/src/ser/fmt.rs:38:6
       |
    38 | impl<'a> Serializer for &mut fmt::Formatter<'a> {
       |      ^^                                     ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
       |
    38 - impl<'a> Serializer for &mut fmt::Formatter<'a> {
    38 + impl Serializer for &mut fmt::Formatter<'_> {
       |

    warning: the following explicit lifetimes could be elided: 'a
      --> serde/src/ser/impls.rs:62:6
       |
    62 | impl<'a> Serialize for fmt::Arguments<'a> {
       |      ^^                               ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
       |
    62 - impl<'a> Serialize for fmt::Arguments<'a> {
    62 + impl Serialize for fmt::Arguments<'_> {
       |

    warning: the following explicit lifetimes could be elided: 'a
      --> serde/src/format.rs:20:6
       |
    20 | impl<'a> Write for Buf<'a> {
       |      ^^                ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
       |
    20 - impl<'a> Write for Buf<'a> {
    20 + impl Write for Buf<'_> {
       |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/private/de.rs:254:10
        |
    254 |     impl<'de> Content<'de> {
        |          ^^^          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    254 -     impl<'de> Content<'de> {
    254 +     impl Content<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/private/de.rs:333:10
        |
    333 |     impl<'de> ContentVisitor<'de> {
        |          ^^^                 ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    333 -     impl<'de> ContentVisitor<'de> {
    333 +     impl ContentVisitor<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/private/de.rs:553:10
        |
    553 |     impl<'de> TagOrContentVisitor<'de> {
        |          ^^^                      ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    553 -     impl<'de> TagOrContentVisitor<'de> {
    553 +     impl TagOrContentVisitor<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'de
       --> serde/src/private/de.rs:937:10
        |
    937 |     impl<'de> Visitor<'de> for TagOrContentFieldVisitor {
        |          ^^^          ^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    937 -     impl<'de> Visitor<'de> for TagOrContentFieldVisitor {
    937 +     impl Visitor<'_> for TagOrContentFieldVisitor {
        |

    warning: the following explicit lifetimes could be elided: 'de
        --> serde/src/private/de.rs:1014:10
         |
    1014 |     impl<'de> Visitor<'de> for TagContentOtherFieldVisitor {
         |          ^^^          ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1014 -     impl<'de> Visitor<'de> for TagContentOtherFieldVisitor {
    1014 +     impl Visitor<'_> for TagContentOtherFieldVisitor {
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:1652:10
         |
    1652 |     impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E>
         |          ^^                                 ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1652 -     impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E>
    1652 +     impl<'de, E> ContentRefDeserializer<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:1735:15
         |
    1735 |     impl<'de, 'a, E> Deserializer<'de> for ContentRefDeserializer<'a, 'de, E>
         |               ^^                                                  ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    1735 -     impl<'de, 'a, E> Deserializer<'de> for ContentRefDeserializer<'a, 'de, E>
    1735 +     impl<'de, E> Deserializer<'de> for ContentRefDeserializer<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2162:15
         |
    2162 |     impl<'de, 'a, E> de::VariantAccess<'de> for VariantRefDeserializer<'a, 'de, E>
         |               ^^                                                       ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2162 -     impl<'de, 'a, E> de::VariantAccess<'de> for VariantRefDeserializer<'a, 'de, E>
    2162 +     impl<'de, E> de::VariantAccess<'de> for VariantRefDeserializer<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2259:15
         |
    2259 |     impl<'de, 'a, E> de::IntoDeserializer<'de, E> for ContentRefDeserializer<'a, 'de, E>
         |               ^^                                                             ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2259 -     impl<'de, 'a, E> de::IntoDeserializer<'de, E> for ContentRefDeserializer<'a, 'de, E>
    2259 +     impl<'de, E> de::IntoDeserializer<'de, E> for ContentRefDeserializer<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2288:15
         |
    2288 |     impl<'de, 'a> Visitor<'de> for InternallyTaggedUnitVisitor<'a> {
         |               ^^                                               ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2288 -     impl<'de, 'a> Visitor<'de> for InternallyTaggedUnitVisitor<'a> {
    2288 +     impl<'de> Visitor<'de> for InternallyTaggedUnitVisitor<'_> {
         |

    warning: the following explicit lifetimes could be elided: 'a, 'de
        --> serde/src/private/de.rs:2333:10
         |
    2333 |     impl<'de, 'a> Visitor<'de> for UntaggedUnitVisitor<'a> {
         |          ^^^  ^^          ^^^                          ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2333 -     impl<'de, 'a> Visitor<'de> for UntaggedUnitVisitor<'a> {
    2333 +     impl Visitor<'_> for UntaggedUnitVisitor<'_> {
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2396:11
         |
    2396 | impl<'de, 'a, E> Deserializer<'de> for StrDeserializer<'a, E>
         |           ^^                                           ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2396 - impl<'de, 'a, E> Deserializer<'de> for StrDeserializer<'a, E>
    2396 + impl<'de, E> Deserializer<'de> for StrDeserializer<'_, E>
         |

    warning: the following explicit lifetimes could be elided: 'a, 'de
        --> serde/src/private/de.rs:2498:6
         |
    2498 | impl<'a, 'de, E> FlatMapDeserializer<'a, 'de, E>
         |      ^^  ^^^                         ^^  ^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2498 - impl<'a, 'de, E> FlatMapDeserializer<'a, 'de, E>
    2498 + impl<E> FlatMapDeserializer<'_, '_, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2522:6
         |
    2522 | impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
         |      ^^                                                    ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2522 - impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E>
    2522 + impl<'de, E> Deserializer<'de> for FlatMapDeserializer<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2658:6
         |
    2658 | impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
         |      ^^                                           ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2658 - impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
    2658 + impl<'de, E> MapAccess<'de> for FlatMapAccess<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde/src/private/de.rs:2702:6
         |
    2702 | impl<'a, 'de, E> MapAccess<'de> for FlatStructAccess<'a, 'de, E>
         |      ^^                                              ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    2702 - impl<'a, 'de, E> MapAccess<'de> for FlatStructAccess<'a, 'de, E>
    2702 + impl<'de, E> MapAccess<'de> for FlatStructAccess<'_, 'de, E>
         |

    warning: the following explicit lifetimes could be elided: 'a
     --> serde/src/de/seed.rs:8:6
      |
    8 | impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T>
      |      ^^                                               ^^
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
      |
    8 - impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T>
    8 + impl<'de, T> DeserializeSeed<'de> for InPlaceSeed<'_, T>
      |

    warning: the following explicit lifetimes could be elided: 'a
       --> serde_derive/src/internals/case.rs:124:6
        |
    124 | impl<'a> Display for ParseError<'a> {
        |      ^^                         ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
        = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]`
    help: elide the lifetimes
        |
    124 - impl<'a> Display for ParseError<'a> {
    124 + impl Display for ParseError<'_> {
        |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde_derive/src/de.rs:3042:6
         |
    3042 | impl<'a> ToTokens for DeImplGenerics<'a> {
         |      ^^                              ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    3042 - impl<'a> ToTokens for DeImplGenerics<'a> {
    3042 + impl ToTokens for DeImplGenerics<'_> {
         |

    warning: the following explicit lifetimes could be elided: 'a
        --> serde_derive/src/de.rs:3124:6
         |
    3124 | impl<'a> ToTokens for DeTypeGenerics<'a> {
         |      ^^                              ^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
         |
    3124 - impl<'a> ToTokens for DeTypeGenerics<'a> {
    3124 + impl ToTokens for DeTypeGenerics<'_> {
         |

    warning: the following explicit lifetimes could be elided: 'a
      --> test_suite/tests/test_serde_path.rs:15:10
       |
    15 |     impl<'a> AssertNotSerdeDeserialize<'a> for Foo {}
       |          ^^                            ^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
       = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]`
    help: elide the lifetimes
       |
    15 -     impl<'a> AssertNotSerdeDeserialize<'a> for Foo {}
    15 +     impl AssertNotSerdeDeserialize<'_> for Foo {}
       |
2024-10-07 21:02:22 +02:00
Mingun
4c5fec1363 Test special cases that reaches SeqRefDeserializer::deserialize_any len==0 condition
failures (2):
    newtype_enum::empty_struct_from_seq
    newtype_enum::tuple0
2024-08-24 04:52:25 +05:00
Mingun
6588b0ad37 Cover Content::Seq case in VariantRefDeserializer::struct_variant 2024-08-24 04:52:25 +05:00
Mingun
0093f74cfe Split test newtype_enum into four tests for each variant
(review this commit with "ignore whitespace changes" option on)
2024-08-24 04:52:25 +05:00
Mingun
171c6da57a Complete coverage of ContentRefDeserializer::deserialize_newtype_struct 2024-08-24 04:52:25 +05:00
Mingun
2dddc7796d Cover ContentRefDeserializer::deserialize_option 2024-08-24 04:52:25 +05:00
Mingun
8514f4119a Remove unnecessary generics 2024-08-24 04:52:24 +05:00
Mingun
98fb7d94aa Move all untagged enum tests (except flatten) into a dedicated module
Moved and renamed:
From test_annotations
- test_expecting_message_untagged_tagged_enum                  => expecting_message
- flatten::enum_::untagged::straitforward                      => contains_flatten

From test_macros
- test_untagged_newtype_struct                                 => newtype_struct
- test_untagged_enum                                           => complex
- test_untagged_enum_with_flattened_integer_key                => contains_flatten_with_integer_key
- test_enum_in_untagged_enum                                   => newtype_enum
- test_untagged_bytes                                          => string_and_bytes
- test_untagged_newtype_variant_containing_unit_struct_not_map => newtype_unit_and_empty_map
2024-08-24 04:52:22 +05:00
Mingun
9f72ce695e Struct: add tests for deserialization from sequence
(review this commit with "ignore whitespace changes" option on)
2024-08-16 22:51:42 +05:00
Mingun
c383e4f953 Tuple: add tests for deserialization from sequence
(review this commit with "ignore whitespace changes" option on)
2024-08-16 22:51:16 +05:00
Mingun
a94d8750fb Newtype: move up the test with tag only 2024-08-16 22:51:13 +05:00
Mingun
b0d651be40 Newtype: add tests for deserialization from sequence
(review this commit with "ignore whitespace changes" option on)
2024-08-16 22:51:13 +05:00
Mingun
d5a9c11b5c No need to test integer and byte array field names, they already tested for Unit case
There is no difference what variant is deserialized so we can test only one kind of variant
2024-08-16 22:51:10 +05:00
Mingun
6bfe1c435a Unit: add tests for deserialization from bytes tag and content fields 2024-08-16 22:43:15 +05:00
Mingun
a02da49b87 Unit: add tests for deserialization from integer tag and content fields 2024-08-16 22:43:15 +05:00
Mingun
29dc6c3367 Unit: add tests for deserialization from sequence
(review this commit with "ignore whitespace changes" option on)
2024-08-16 22:38:02 +05:00
Mingun
3dc6829303 Integrate bytes test into struct_ test
`newtype` test also integrates test with `Bytes` tag, so be like

Removed the first assert_tokens because it is the same as the first assert in the merged method
2024-08-16 21:39:53 +05:00
Mingun
42e63ff942 Reuse AdjacentlyTagged enum in bytes test
Change 0i32 to 1u8 so the test can be merged with the previous in the next commit
2024-08-16 21:38:23 +05:00
Mingun
df07751e6f Group newtype and newtype_with_newtype tests 2024-08-16 21:36:56 +05:00
Mingun
5445f1741b Reuse AdjacentlyTagged enum in newtype_with_newtype test 2024-08-16 21:36:56 +05:00
Mingun
9d0f811221 Remove unnecessary generic 2024-08-16 21:36:56 +05:00
Mingun
36b9a859c4 Test deserialization of the serialized unit format for adjacently tagged enum 2024-08-16 21:36:55 +05:00
Mingun
59628d1712 Create only one value for all checks 2024-08-16 21:36:55 +05:00
Mingun
bee7470715 Split test test_adjacently_tagged_enum into four tests for each variant
(review this commit with "ignore whitespace changes" option on)
2024-08-16 21:36:55 +05:00
Mingun
5a359e10f4 Group Newtype variant checks in test_adjacently_tagged_enum together 2024-08-16 21:36:55 +05:00
Mingun
5e37ade519 Move all adjacently tagged enum tests (except flatten) into a dedicated module
Moved and renamed:
From test_annotatons
- test_adjacently_tagged_enum_bytes               => bytes
- flatten::enum_::adjacently_tagged::straitforward=> struct_with_flatten
- test_expecting_message_adjacently_tagged_enum   => expecting_message
- test_partially_untagged_adjacently_tagged_enum  => partially_untagged

From test_macros
- test_adjacently_tagged_newtype_struct           => newtype_with_newtype
- test_adjacently_tagged_enum
- test_adjacently_tagged_enum_deny_unknown_fields => deny_unknown_fields
2024-08-16 21:36:52 +05:00
Mingun
2adb0e99b0 Add additional checks for unit and newtype_unit tests
- check that unit variant can be deserialized from a map
- check that newtype variant with unit can be deserialized from a struct
2024-08-15 23:39:14 +05:00
Mingun
71ed1f2f12 Add tests for special and general cases for internally tagged enums
Special case is the tag field first (so the enum variant are known after reading the first entry from map).
General case is the tag field not the first (so we need to buffer entries until we found an entry with tag)
2024-08-15 23:39:13 +05:00
Mingun
47954502af Add tests with borrowed strings for the tag field name and tag value 2024-08-15 23:39:13 +05:00
Mingun
4987fd15f7 Convert newtype_enum and struct_enum tests into modules
Separate testing each variant kind of enum (unit, newtype, tuple, struct) results
in more specific information if that checks fail

(review this commit with "ignore whitespace changes" option on)
2024-08-15 23:39:12 +05:00
Mingun
8bfe0d0ac0 Move and rename tests:
- newtype_variant_containing_unit                   -> newtype_unit
- newtype_variant_containing_unit_struct            -> newtype_unit_struct
- newtype_variant_containing_externally_tagged_enum -> newtype_enum
- struct_variant_containing_unit_variant            -> struct_enum
2024-08-15 23:39:12 +05:00
Mingun
7c0e6bd18f Reuse type in struct_variant_containing_unit_variant 2024-08-15 23:39:11 +05:00