mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
Put doc cfg on Clone impls
This commit is contained in:
parent
e1b2e9fc44
commit
82777db3db
@ -82,8 +82,10 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {
|
||||
if copy {
|
||||
return quote! {
|
||||
#cfg_features
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Copy for #ident {}
|
||||
#cfg_features
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for #ident {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -96,6 +98,7 @@ fn expand_impl(defs: &Definitions, node: &Node) -> TokenStream {
|
||||
|
||||
quote! {
|
||||
#cfg_features
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for #ident {
|
||||
fn clone(&self) -> Self {
|
||||
#body
|
||||
|
183
src/gen/clone.rs
183
src/gen/clone.rs
File diff suppressed because it is too large
Load Diff
@ -367,6 +367,7 @@ impl Generics {
|
||||
macro_rules! generics_wrapper_impls {
|
||||
($ty:ident) => {
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl<'a> Clone for $ty<'a> {
|
||||
fn clone(&self) -> Self {
|
||||
$ty(self.0)
|
||||
|
@ -578,6 +578,7 @@ mod debug_impls {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for LitRepr {
|
||||
fn clone(&self) -> Self {
|
||||
LitRepr {
|
||||
@ -588,6 +589,7 @@ impl Clone for LitRepr {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for LitIntRepr {
|
||||
fn clone(&self) -> Self {
|
||||
LitIntRepr {
|
||||
@ -599,6 +601,7 @@ impl Clone for LitIntRepr {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for LitFloatRepr {
|
||||
fn clone(&self) -> Self {
|
||||
LitFloatRepr {
|
||||
@ -612,6 +615,7 @@ impl Clone for LitFloatRepr {
|
||||
macro_rules! lit_extra_traits {
|
||||
($ty:ident) => {
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for $ty {
|
||||
fn clone(&self) -> Self {
|
||||
$ty {
|
||||
|
@ -346,6 +346,7 @@ impl<T, P> Punctuated<T, P> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl<T, P> Clone for Punctuated<T, P>
|
||||
where
|
||||
T: Clone,
|
||||
@ -932,6 +933,7 @@ impl<T, P> Pair<T, P> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl<T, P> Clone for Pair<T, P>
|
||||
where
|
||||
T: Clone,
|
||||
|
@ -26,6 +26,7 @@ impl Default for Reserved {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for Reserved {
|
||||
fn clone(&self) -> Self {
|
||||
Reserved {
|
||||
|
@ -268,9 +268,11 @@ macro_rules! define_keywords {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Copy for $name {}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for $name {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -385,9 +387,11 @@ macro_rules! define_punctuation_structs {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Copy for $name {}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for $name {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -488,9 +492,11 @@ macro_rules! define_delimiters {
|
||||
}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Copy for $name {}
|
||||
|
||||
#[cfg(feature = "clone-impls")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))]
|
||||
impl Clone for $name {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
|
Loading…
Reference in New Issue
Block a user