David Tolnay
6c3bf7a2fc
Ignore poor suggestion from branches_sharing_code lint
...
https://github.com/rust-lang/rust-clippy/issues/7054
error: all if blocks contain the same code at the end
--> serde_derive/src/de.rs:2160:5
|
2160 | / &fallthrough_arm_tokens
2161 | | };
| |_____^
|
note: the lint level is defined here
--> serde_derive/src/lib.rs:18:9
|
18 | #![deny(clippy::all, clippy::pedantic)]
| ^^^^^^^^^^^
= note: `#[deny(clippy::branches_sharing_code)]` implied by `#[deny(clippy::all)]`
= note: The end suggestion probably needs some adjustments to use the expression result correctly
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#branches_sharing_code
help: consider moving the end statements out like this
|
2160 | }
2161 | &fallthrough_arm_tokens;
|
2021-04-08 20:08:42 -07:00
David Tolnay
ce0844b9ec
Suppress match_wildcard_for_single_variants clippy false positive
...
https://github.com/rust-lang/rust-clippy/issues/6984
error: wildcard matches only a single variant and will also match any future added variants
--> serde_derive/src/internals/attr.rs:1918:9
|
1918 | _ => {}
| ^ help: try this: `syn::Type::__TestExhaustive(_)`
|
note: the lint level is defined here
--> serde_derive/src/lib.rs:18:22
|
18 | #![deny(clippy::all, clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::match_wildcard_for_single_variants)]` implied by `#[deny(clippy::pedantic)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
error: wildcard matches only a single variant and will also match any future added variants
--> serde_derive/src/internals/receiver.rs:153:13
|
153 | _ => {}
| ^ help: try this: `Type::__TestExhaustive(_)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
error: wildcard matches only a single variant and will also match any future added variants
--> serde_derive/src/bound.rs:190:17
|
190 | _ => {}
| ^ help: try this: `syn::Type::__TestExhaustive(_)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
2021-03-26 23:30:15 -04:00
David Tolnay
e9270e59f0
Release 1.0.125
2021-03-22 16:15:57 -07:00
David Tolnay
72060b779a
Extend test_format_u8 to include u8::MAX
...
This is equivalent to looping 0..=u8::MAX, except that `..=` syntax is
not supported on old rustc and `...` syntax is not supported on new
rustc, so loop it is.
2021-03-22 16:09:33 -07:00
David Tolnay
1bb23ad9d1
Remove format_u8 when not used by Ipv4Addr impl
2021-03-22 16:00:58 -07:00
David Tolnay
9be4c9654a
Merge pull request 2001 from saethlin/optimize-ipaddr
2021-03-22 16:00:11 -07:00
David Tolnay
5a8dcac2ed
Release 1.0.124
2021-03-05 19:55:40 -08:00
David Tolnay
697b082e90
Touch up PR 1997
2021-03-05 19:48:40 -08:00
David Tolnay
d91075c8d5
Merge pull request #1997 from cyang1/systemtime-panics
...
Prevent various panics when deserializing malformed SystemTime
2021-03-05 18:35:48 -08:00
David Tolnay
c261015325
Ignore incorrect suggestion from manual_map lint
...
https://github.com/rust-lang/rust-clippy/issues/6797
error[E0382]: use of partially moved value: `self`
--> serde_derive/src/internals/attr.rs:71:24
|
71 | self.value.map(|value| (self.tokens, value))
| ----^^^^^^^----------------------
| | | |
| | | use occurs due to use in closure
| | value used here after partial move
| `self.value` partially moved due to this method call
|
note: this function takes ownership of the receiver `self`, which moves `self.value`
--> /home/david/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:485:38
|
485 | pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
| ^^^^
= note: partial move occurs because `self.value` has type `std::option::Option<T>`, which does not implement the `Copy` trait
2021-02-25 20:53:45 -08:00
David Tolnay
6b5e5a83d0
Ignore let_underscore_drop pedantic clippy lint
2021-02-18 19:31:39 -08:00
David Tolnay
bc6b2b1dee
Make json5 description capitalization consistent with other links
2021-02-10 23:13:12 -08:00
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
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
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
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
David Tolnay
5aa163f27e
Revert "Regenerate macrotest outputs for PR #1917 "
...
This reverts commit 999b94d6ae .
2021-01-23 20:36:26 -08:00
David Tolnay
3728d3c67a
Eliminate duplicated borrowed and non-borrowed identifier deserialization
2021-01-23 20:32:38 -08:00
David Tolnay
3f48ed36cc
Restore compatibility with rustc <1.31 in Borrowed identifier deserializer
...
The implied lifetime bound on T only works on 1.31+. Older versions fail
with:
error[E0309]: the parameter type `T` may not live long enough
--> serde/src/private/de.rs:2548:37
|
2548 | pub struct Borrowed<'de, T: ?Sized>(pub &'de T);
| -- ^^^^^^^^^^
| |
| help: consider adding an explicit lifetime bound `T: 'de`...
|
note: ...so that the reference type `&'de T` does not outlive the data it points at
--> serde/src/private/de.rs:2548:37
|
2548 | pub struct Borrowed<'de, T: ?Sized>(pub &'de T);
| ^^^^^^^^^^
2021-01-23 20:19:33 -08:00
David Tolnay
b6a2d07f26
Return IdentifierDeserializer to just one associated type
...
The BorrowedDeserializer was added in #1917 , but only makes sense for
&str and &[u8], not for u64 which also needs to be have an
IdentifierDeserializer impl.
2021-01-23 20:04:58 -08:00
David Tolnay
84ad76b2e5
Ignore too_many_lines clippy pedantic lint in serde_test
...
error: this function has too many lines (107/100)
--> serde_test/src/de.rs:128:5
|
128 | / fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
129 | | where
130 | | V: Visitor<'de>,
131 | | {
... |
238 | | }
239 | | }
| |_____^
|
note: the lint level is defined here
--> serde_test/src/lib.rs:149:52
|
149 | #![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
| ^^^^^^^^^^^^^^^
= note: `#[deny(clippy::too_many_lines)]` implied by `#[deny(clippy::pedantic)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
2021-01-23 20:04:30 -08:00
David Tolnay
e6b6602a42
Merge pull request 1914 from Mingun/seq-other
2021-01-23 19:50:39 -08:00
David Tolnay
999b94d6ae
Regenerate macrotest outputs for PR #1917
2021-01-23 19:43:02 -08:00
David Tolnay
fa6712d2bf
Merge pull request #1918 from Mingun/fix-serde-test
...
Fix incorrect message in serializer tokens and correctly implement next_entry_seed
2021-01-23 15:02:32 -08:00
David Tolnay
012ea8eb84
Keep conditional compilation cfg naming consistent with serde crate
...
The serde crate's build.rs uses names like `core_duration` or
`integer128`, not `has_core_duration` / `has_integer128`.
2021-01-23 14:57:12 -08:00
David Tolnay
9add5812e2
Update track_caller cfg link to show what version it's in
2021-01-23 14:56:03 -08:00
David Tolnay
5fd52100b6
Merge pull request #1920 from Mingun/track_caller
...
Show correct location in error messages by tracking caller of utility `assert_tokens` functions
2021-01-23 14:54:24 -08:00
David Tolnay
6670a309ca
Merge pull request #1961 from serde-rs/renamerule
...
Provide list of recognized rename rules on parse error
2021-01-23 14:50:02 -08:00
David Tolnay
b7bad3a165
Restore compatibility with rustc 1.31 in RenameRule error
...
str::escape_debug wasn't stabilized until 1.34, whereas serde_derive
currently supports an oldest version of 1.31.
2021-01-23 14:40:44 -08:00
David Tolnay
4e002ece07
Provide list of recognized rename rules on parse error
2021-01-23 14:38:20 -08:00
David Tolnay
eaccae2c46
Fix UPPERCASE rename rule variant to follow idiomatic variant naming
...
This shouldn't have been named this way in PR #1132 .
2021-01-23 14:27:33 -08:00
David Tolnay
990a502c39
Parse rename rules based on table of rules
...
This will make it possible to reuse the same table of recognized rules
in the parse error message.
2021-01-23 14:24:21 -08:00
David Tolnay
661206d885
Merge pull request #1960 from serde-rs/renamerule
...
Deduplicate RenameRule parse error message generation
2021-01-23 14:23:09 -08:00
David Tolnay
51d4563ed1
Move RenameRule parse error message to a Display impl
2021-01-23 14:13:47 -08:00
David Tolnay
7db0982e58
Add error type to use for RenameRule parsing
2021-01-23 14:09:58 -08:00
David Tolnay
ed04824f10
Move RenameRule parse from trait fn to associated
...
This will allow updating it to return an Err that borrows the input
string, which is not possible with FromStr.
2021-01-23 14:07:59 -08:00
David Tolnay
88ee470a1c
Format PR #1916 with rustfmt 1.4.32
2021-01-23 13:39:12 -08:00
David Tolnay
a5ecbdb4f4
Merge pull request 1916 from Mingun/expecting-customize
2021-01-23 13:38:45 -08:00
David Tolnay
bd588db067
Release 1.0.121
2021-01-23 13:17:08 -08:00
David Tolnay
8f09aeacdd
Merge pull request #1959 from serde-rs/1917
...
Touch up borrowed field identifiers PR
2021-01-23 13:15:30 -08:00
David Tolnay
0b5c56b0db
Touch up documentation from PR #1917
2021-01-23 13:09:37 -08:00
David Tolnay
85de92e6f7
Inline forward_deserializer for bytes deserializers
2021-01-23 13:08:08 -08:00
David Tolnay
c858a1fa77
Clean up unnecessary macro_use from PR #1917
2021-01-23 12:59:12 -08:00
David Tolnay
d02eb22557
Inline some unnecessary constructor functions from PR #1917
2021-01-23 12:58:42 -08:00
David Tolnay
034fe25d5b
Remove redundant unused trait impls from private types from PR #1917
2021-01-23 12:58:42 -08:00
David Tolnay
0a230e8598
Inline forward_deserializer into private::de for Str deserializers
...
We shouldn't try to use the same macro for public and private types. The
API for a private type can usually be pared much further down to save
compile time, such as Debug and Copy and Clone impls.
2021-01-23 12:57:35 -08:00
David Tolnay
b20214d4a0
Undo macro exports from PR #1917
...
All of these macros are only used internally within the serde crate.
There is no need for them to have #[macro_export] and need to be hidden
from docs.
2021-01-23 12:40:01 -08:00
David Tolnay
34f4b68f77
Fix unneeded clone from PR #1917
2021-01-23 12:40:00 -08:00
David Tolnay
60e08f9545
Format PR #1917 with rustfmt 1.4.32
2021-01-23 12:39:59 -08:00
David Tolnay
ba46f45dc5
Merge pull request 1917 from Mingun/borrow-identifier
2021-01-23 12:39:28 -08:00
David Tolnay
44b9567e21
Merge pull request #1958 from jonasbb/duration-panic
...
Prevent panic when deserializing malformed Duration
2021-01-23 00:45:39 -08:00
David Tolnay
398fba9b1e
Release 1.0.120
2021-01-18 22:55:13 -08:00
David Tolnay
cd6697b0e4
Merge pull request #1955 from TheJokr/patch-1
...
Add 128-bit integer support to de::IgnoredAny
2021-01-18 22:54:43 -08:00
David Tolnay
78a9dbc57e
Merge pull request #1948 from Marwes/from_str
...
refactor: Merge multiple FromStr visitors to a single FromStrVisitor
2021-01-12 13:12:54 -08:00
David Tolnay
391d3ababf
Touch up PR 1948
2021-01-12 13:08:50 -08:00
David Tolnay
4c89cf89fd
Release 1.0.119
2021-01-11 12:13:57 -08:00
David Tolnay
b0c99ed761
Restore compatibility with rustc 1.13.0
...
error[E0432]: unresolved import `private::de::size_hint`
--> src/de/value.rs:28:5
|
28 | use private::de::size_hint;
| ^^^^^^^^^^^^^^^^^^^^^^ Maybe a missing `extern crate private`?
2021-01-08 20:01:30 -08:00
David Tolnay
dd1f4b483e
Make it clearer that the private implementation details are private
...
Both of these modules are doc(hidden) and commented "Not public API",
but incorrect downstream code sometimes still references them. Naming
the module __private will make it more likely to be noticed in code
review.
2021-01-08 19:55:31 -08:00
David Tolnay
91bfa8f947
Refresh expandtest files with most recent rustfmt
2021-01-08 19:54:21 -08:00