forked from serde-rs/serde
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow floats to be deserialized from ints in tagged unions, part 2 #1
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove the tiny bit of unsafe code
These are left over from a series of unfortunate rustfmt interactions. serde-rs@ee75e6c#diff-c052b162f01a664f8184ef1855d1f1cfL767-R735 serde-rs@cc2558b#diff-c052b162f01a664f8184ef1855d1f1cfL733-R738 serde-rs@9f38ca0#diff-c052b162f01a664f8184ef1855d1f1cfL779-R782
Allow #[serde(borrow)] for non-std Cow
Simplify default Serializer::collect_str implementation
Hide generated dummy const in rustdoc
Support for badges has been deprecated by crates.io.
Enable GitHub Actions
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
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
Reduce post-macro-expansion code in integer deserialize impls
Allow floats to be deserialized from ints in tagged unions
Collect lifetimes inside macro invocations
Omit derive helpers in versions older than serde_derive msrv
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).
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
Support `Self` inside fields that use serialize_with
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expand the fix from serde-rs#1842 to ContentRefDeserializer.