Eliminate 2015-style module system imports from serde_derive
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Tolnay · committed by David Tolnay · parent 89f84c2 · Browse files · 11 files·+21 added−34 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+21 added−34 removed
- other:+21 added−34 removed
Provenance
- Commit
30f79b3- Tree
f98a508- Author
David Tolnay <dtolnay@gmail.com>- Committer
David Tolnay <dtolnay@gmail.com>- Parent
89f84c2
11 files changed+21 added−34 removed
modified:serde_derive/src/internals/ast.rs+1 added-4 removed
1 //! A Serde ast, parsed from the Syn ast and ready to generate Rust code.2 3-use internals::attr;4-use internals::check;5-use internals::{Ctxt, Derive};6-use syn;3+use crate::internals::{attr, check, Ctxt, Derive};4 use syn::punctuated::Punctuated;5 6 /// A source data structure annotated with `#[derive(Serialize)]` and/or `#[derive(Deserialize)]`,7 /// parsed into an internal representation.205 unmodified linesmodified:serde_derive/src/internals/attr.rs+3 added-4 removed
1-use internals::symbol::*;2-use internals::{ungroup, Ctxt};1+use crate::internals::symbol::*;2+use crate::internals::{ungroup, Ctxt};3 use proc_macro2::{Spacing, Span, TokenStream, TokenTree};4 use quote::ToTokens;5 use std::borrow::Cow;6 use std::collections::BTreeSet;7 use std::iter::FromIterator;8-use syn;8 use syn::meta::ParseNestedMeta;9 use syn::parse::ParseStream;10 use syn::punctuated::Punctuated;11 use syn::{token, Ident, Lifetime};5 unmodified lines17 // duplicated attributes result in a span_err but otherwise are ignored. The18 // user will see errors simultaneously for all bad attributes in the crate19 // rather than just the first.20 22-pub use internals::case::RenameRule;21+pub use crate::internals::case::RenameRule;22 23 struct Attr<'c, T> {24 cx: &'c Ctxt,25 name: Symbol,1786 unmodified linesmodified:serde_derive/src/internals/check.rs+3 added-3 removed
1-use internals::ast::{Container, Data, Field, Style};2-use internals::attr::{Identifier, TagType};3-use internals::{ungroup, Ctxt, Derive};1+use crate::internals::ast::{Container, Data, Field, Style};2+use crate::internals::attr::{Identifier, TagType};3+use crate::internals::{ungroup, Ctxt, Derive};4 use syn::{Member, Type};5 6 // Cross-cutting checks that require looking at more than a single attrs object.7 // Simpler checks should happen when parsing and building the attrs.431 unmodified linesmodified:serde_derive/src/internals/ctxt.rs-1 removed
1 use quote::ToTokens;2 use std::cell::RefCell;3 use std::fmt::Display;4 use std::thread;5-use syn;5 6 /// A type to collect errors together and format them.7 ///8 /// Dropping this object will cause a panic. It must be consumed using `check`.60 unmodified linesmodified:serde_derive/src/internals/receiver.rs+1 added-1 removed
1-use internals::respan::respan;1+use crate::internals::respan::respan;2 use proc_macro2::Span;3 use quote::ToTokens;4 use std::mem;5 use syn::punctuated::Punctuated;287 unmodified linesmodified:serde_derive/src/bound.rs+2 added-3 removed
1 use std::collections::HashSet;2 3-use syn;3 use syn::punctuated::{Pair, Punctuated};4 6-use internals::ast::{Container, Data};7-use internals::{attr, ungroup};5+use crate::internals::ast::{Container, Data};6+use crate::internals::{attr, ungroup};7 8 use proc_macro2::Span;9 10 // Remove the default from every type parameter because in the generated impls403 unmodified linesmodified:serde_derive/src/de.rs+4 added-7 removed
4 unmodified lines5 use syn::punctuated::Punctuated;6 use syn::spanned::Spanned;7 use syn::{self, Ident, Index, Member};8 9-use bound;10-use dummy;11-use fragment::{Expr, Fragment, Match, Stmts};12-use internals::ast::{Container, Data, Field, Style, Variant};13-use internals::{attr, replace_receiver, ungroup, Ctxt, Derive};14-use pretend;9+use crate::fragment::{Expr, Fragment, Match, Stmts};10+use crate::internals::ast::{Container, Data, Field, Style, Variant};11+use crate::internals::{attr, replace_receiver, ungroup, Ctxt, Derive};12+use crate::{bound, dummy, pretend, this};15-use this;13 14 use std::collections::BTreeSet;15 use std::ptr;16 3176 unmodified linesmodified:serde_derive/src/dummy.rs+1 added-2 removed
1 use proc_macro2::TokenStream;2 3-use syn;4-use try;3+use crate::try;4 5 pub fn wrap_in_const(serde_path: Option<&syn::Path>, code: TokenStream) -> TokenStream {6 let try_replacement = try::replacement();7 20 unmodified linesmodified:serde_derive/src/pretend.rs+1 added-1 removed
1 use proc_macro2::TokenStream;2 use quote::format_ident;3 4-use internals::ast::{Container, Data, Field, Style, Variant};4+use crate::internals::ast::{Container, Data, Field, Style, Variant};5 6 // Suppress dead_code warnings that would otherwise appear when using a remote7 // derive. Other than this pretend code, a struct annotated with remote derive8 // never has its fields referenced and an enum annotated with remote derive178 unmodified linesmodified:serde_derive/src/ser.rs+4 added-7 removed
1 use proc_macro2::{Span, TokenStream};2 use syn::spanned::Spanned;3 use syn::{self, Ident, Index, Member};4 5-use bound;6-use dummy;7-use fragment::{Fragment, Match, Stmts};8-use internals::ast::{Container, Data, Field, Style, Variant};9-use internals::{attr, replace_receiver, Ctxt, Derive};10-use pretend;5+use crate::fragment::{Fragment, Match, Stmts};6+use crate::internals::ast::{Container, Data, Field, Style, Variant};7+use crate::internals::{attr, replace_receiver, Ctxt, Derive};8+use crate::{bound, dummy, pretend, this};11-use this;9 10 pub fn expand_derive_serialize(input: &mut syn::DeriveInput) -> syn::Result<TokenStream> {11 replace_receiver(input);12 1326 unmodified linesmodified:serde_derive/src/this.rs+1 added-1 removed
1-use internals::ast::Container;1+use crate::internals::ast::Container;2 use syn::{Path, PathArguments, Token};3 4 pub fn this_type(cont: &Container) -> Path {5 if let Some(remote) = cont.attrs.remote() {27 unmodified lines