Commit Graph

3175 Commits

Author SHA1 Message Date
David Tolnay
beb21cb640
Ignore new missing_panics_doc pedantic clippy lint 2021-02-03 20:07:44 -08:00
David Tolnay
7cfebbcd72
Merge pull request #1974 from Mingun/new-internally-tagged-tests
New internally tagged tests
2021-02-02 15:23:10 -08:00
Mingun
b60c03ec3f Extend test_internally_tagged_newtype_variant_containing_unit_struct to cover structs and seqs 2021-02-02 09:00:04 +05:00
Mingun
3257851192 Extend test_internally_tagged_struct_variant_containing_unit_variant to cover maps and seqs 2021-02-02 08:59:59 +05:00
David Tolnay
9a84622c56
Merge pull request #1971 from arthurprs/untagged-enum-fix-pr
Allow floats to be deserialized from ints in untagged unions (part 2)
2021-01-26 14:41:56 -08:00
Arthur Silva
de8ac1c0be Allow floats to be deserialized from ints in untagged unions 2021-01-26 17:47:20 +01:00
David Tolnay
3d6c4149b1
Release 1.0.123 2021-01-25 13:43:11 -08:00
David Tolnay
29cdf888c0
Merge pull request #1970 from serde-rs/self
Support `Self` inside fields that use serialize_with
2021-01-25 13:42:35 -08:00
David Tolnay
2ba97394fb
Substitute Self in output of Serialize derive 2021-01-25 13:34:09 -08:00
David Tolnay
6699b0bc40
Add regression test for issue 1969 2021-01-25 13:34:08 -08:00
David Tolnay
b054ea4105
Ignore some pedantic lints in serde_derive_internals from PR 1830
error: item name ends with its containing module's name
      --> serde_derive_internals/src/receiver.rs:11:1
       |
    11 | / pub fn replace_receiver(input: &mut DeriveInput) {
    12 | |     let self_ty = {
    13 | |         let ident = &input.ident;
    14 | |         let ty_generics = input.generics.split_for_impl().1;
    ...  |
    19 | |     visitor.visit_data_mut(&mut input.data);
    20 | | }
       | |_^
       |
    note: the lint level is defined here
      --> serde_derive_internals/lib.rs:3:22
       |
    3  | #![deny(clippy::all, clippy::pedantic)]
       |                      ^^^^^^^^^^^^^^^^
       = note: `#[deny(clippy::module_name_repetitions)]` implied by `#[deny(clippy::pedantic)]`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions

    error: binding's name is too similar to existing binding
      --> serde_derive_internals/src/receiver.rs:31:29
       |
    31 |     fn self_to_qself(&self, qself: &mut Option<QSelf>, path: &mut Path) {
       |                             ^^^^^
       |
    note: the lint level is defined here
      --> serde_derive_internals/lib.rs:3:22
       |
    3  | #![deny(clippy::all, clippy::pedantic)]
       |                      ^^^^^^^^^^^^^^^^
       = note: `#[deny(clippy::similar_names)]` implied by `#[deny(clippy::pedantic)]`
    note: existing binding defined here
      --> serde_derive_internals/src/receiver.rs:31:23
       |
    31 |     fn self_to_qself(&self, qself: &mut Option<QSelf>, path: &mut Path) {
       |                       ^^^^
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#similar_names

    error: unused `self` argument
       --> serde_derive_internals/src/receiver.rs:286:24
        |
    286 |     fn visit_macro_mut(&mut self, _mac: &mut Macro) {}
        |                        ^^^^^^^^^
        |
    note: the lint level is defined here
       --> serde_derive_internals/lib.rs:3:22
        |
    3   | #![deny(clippy::all, clippy::pedantic)]
        |                      ^^^^^^^^^^^^^^^^
        = note: `#[deny(clippy::unused_self)]` implied by `#[deny(clippy::pedantic)]`
        = help: consider refactoring to a associated function
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
2021-01-25 00:03:03 -08:00
David Tolnay
e5efb6ad93
Remove dependency on syn/visit-mut feature 2021-01-24 23:56:57 -08:00
David Tolnay
1f423580a5
Deduplicate token stream respanner 2021-01-24 23:06:08 -08:00
David Tolnay
033114a4ae
Touch up PR 1830 2021-01-24 23:06:07 -08:00
David Tolnay
7cec99c7fd
Pare down PR 1830
Unlike expr macros, macros in type position in a derive input are rare
enough that it's not worth supporting for an issue that has such an easy
workaround (just replace `Self` in the macro input with your type name).
2021-01-24 23:06:06 -08:00
David Tolnay
6c5bf701be
Merge pull request 1830 from taiki-e/self 2021-01-24 23:05:51 -08:00
David Tolnay
6e800ff826
Test exhaustiveness of type match in collect_lifetimes 2021-01-24 23:04:01 -08:00
David Tolnay
68bda7a004
Include serde crate in 1.31 CI job 2021-01-24 20:42:20 -08:00
David Tolnay
dfeaf77bb2
Merge pull request #1966 from serde-rs/private
Omit derive helpers in versions older than serde_derive msrv
2021-01-24 20:40:06 -08:00
David Tolnay
b0cc213e57
Omit derive helpers in versions older than serde_derive msrv 2021-01-24 20:26:56 -08:00
David Tolnay
74ca06662e
Omit size_hint::cautious when not allocating 2021-01-24 20:24:03 -08:00
David Tolnay
38edb473de
Move size_hint module out of private::de 2021-01-24 20:23:07 -08:00
David Tolnay
1c03647656
Move InPlaceSeed out of private mod 2021-01-24 20:23:06 -08:00
David Tolnay
aeee73fe92
Merge pull request #1831 from taiki-e/borrow-macro
Collect lifetimes inside macro invocations
2021-01-24 19:08:20 -08:00
David Tolnay
1a3ef39040
Merge pull request #1842 from Timmmm/fix2
Allow floats to be deserialized from ints in tagged unions
2021-01-24 18:48:46 -08:00
David Tolnay
deaf600af7
Merge pull request #1965 from serde-rs/int
Reduce post-macro-expansion code in integer deserialize impls
2021-01-24 18:43:36 -08:00
David Tolnay
48556a4c7f
Reduce post-macro-expansion code in integer deserialize impls 2021-01-24 18:26:50 -08:00
David Tolnay
d88a4748f7
Remove unused $ty arg from internal impl_deserialize_num macro 2021-01-24 17:06:36 -08:00
David Tolnay
ffed19243d
Release 1.0.122 2021-01-24 16:17:29 -08:00
David Tolnay
bb7f94df84
Add serde_derive_internals to clippy CI job 2021-01-24 16:11:37 -08:00
David Tolnay
ff0f467e25
Opt in to pedantic clippy lints in serde_derive_internals 2021-01-24 16:10:36 -08:00
David Tolnay
d1975f3661
Update serde_derive_internals to tool attrs 2021-01-24 16:08:42 -08:00
David Tolnay
b91713e824
Suppress clippy should_implement_trait lint
I think there is no ambiguity in from_str as a method name so "choose a
less ambiguous method name" is unnecessary, and it can't be a FromStr
impl in this case because FromStr's error type cannot borrow from the
input string slice.

    warning: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str`
      --> serde_derive_internals/src/case.rs:50:5
       |
    50 | /     pub fn from_str(rename_all_str: &str) -> Result<Self, ParseError> {
    51 | |         for (name, rule) in RENAME_RULES {
    52 | |             if rename_all_str == *name {
    53 | |                 return Ok(*rule);
    ...  |
    58 | |         })
    59 | |     }
       | |_____^
       |
       = note: `#[warn(clippy::should_implement_trait)]` on by default
       = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
2021-01-24 16:04:51 -08:00
David Tolnay
6ea446fb4b
Suppress clippy unused_self pedantic lint
This usage is fine. It's mirroring trait signatures in syn::visit::Visit.

    error: unused `self` argument
       --> serde_derive/src/bound.rs:241:24
        |
    241 |         fn visit_macro(&mut self, _mac: &'ast syn::Macro) {}
        |                        ^^^^^^^^^
        |
    note: the lint level is defined here
       --> serde_derive/src/lib.rs:18:22
        |
    18  | #![deny(clippy::all, clippy::pedantic)]
        |                      ^^^^^^^^^^^^^^^^
        = note: `#[deny(clippy::unused_self)]` implied by `#[deny(clippy::pedantic)]`
        = help: consider refactoring to a associated function
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
2021-01-24 16:01:05 -08:00
David Tolnay
85c6904a93
Remove dependency on syn/visit feature
The builtin visitor is fairly expensive to compile (3700 lines of code),
particularly if something else in the dependency graph also enables
syn/full. For the usage in serde_derive, it turns out to be easy to
replace.
2021-01-24 15:50:41 -08:00
David Tolnay
2fd5212204
Remove unused trait impls on private MapAsEnum 2021-01-23 23:19:48 -08:00
David Tolnay
7d1bc1f0fc
Merge pull request #1963 from serde-rs/valuedebug
Eliminate inferred bound on error type of value deserializer Debug impls
2021-01-23 23:19:36 -08:00
David Tolnay
cdc2fa1b9f
Eliminate inferred bound on error type of value deserializer Debug impls 2021-01-23 23:15:41 -08:00
David Tolnay
ac4001e590
Remove some unused trait impls from private UnitOnly variant accessor 2021-01-23 23:07:13 -08:00
David Tolnay
fbcb2230bb
Make use of fmt::Result type alias from libcore 2021-01-23 22:57:13 -08:00
David Tolnay
86c88bea12
Hide some irrelevant detail from de::value::Error's Debug impl 2021-01-23 22:49:00 -08:00
David Tolnay
82d0fe00fd
Add link to rust-lang/rust#67295 2021-01-23 22:32:30 -08:00
David Tolnay
e61261e002
Move doctest-only helpers to a doc module 2021-01-23 22:32:30 -08:00
David Tolnay
9fd56cd41c
Remove unused __private_deserialize macro, originally for doctests 2021-01-23 22:26:16 -08:00
Taiki Endo
e81f54fbc8 Make AST borrow checker happy 2021-01-24 15:23:54 +09:00
Taiki Endo
c67017d466 Fix handling of Self keyword in type definition 2021-01-24 15:23:51 +09:00
David Tolnay
f6e7366b46
Remove unused Debug impl on private::ser::content::Content 2021-01-23 22:10:48 -08:00
David Tolnay
1f9f72bc48
Merge pull request 1898 from Mingun/bytes-into-deserializer 2021-01-23 22:04:20 -08:00
David Tolnay
e24dbc418d
Skip another clone of the fallthrough arm 2021-01-23 20:52:03 -08:00
David Tolnay
18e5b03fd1
Merge pull request #1962 from serde-rs/dupborrowed
Eliminate duplicated borrowed and non-borrowed identifier deserialization
2021-01-23 20:51:56 -08:00