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
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