Skip to content

Commit d2efc54

Browse files
committed
Remove DeprecationNotes feature
This was never used within the crate
1 parent 2418ab4 commit d2efc54

File tree

5 files changed

+3
-135
lines changed

5 files changed

+3
-135
lines changed

derive_builder_core/src/builder.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use quote::{format_ident, ToTokens, TokenStreamExt};
55
use syn::punctuated::Punctuated;
66
use syn::{Path, TraitBound, TraitBoundModifier, TypeParamBound};
77

8-
use crate::{
9-
doc_comment_from, BuildMethod, BuilderField, BuilderPattern, DeprecationNotes, Setter,
10-
};
8+
use crate::{doc_comment_from, BuildMethod, BuilderField, BuilderPattern, Setter};
119

1210
const ALLOC_NOT_ENABLED_ERROR: &str = r#"`alloc` is disabled within 'derive_builder', consider one of the following:
1311
* enable feature `alloc` on 'dervie_builder' if a `global_allocator` is present
@@ -146,8 +144,6 @@ pub struct Builder<'a> {
146144
pub must_derive_clone: bool,
147145
/// Doc-comment of the builder struct.
148146
pub doc_comment: Option<syn::Attribute>,
149-
/// Emit deprecation notes to the user.
150-
pub deprecation_notes: DeprecationNotes,
151147
/// Whether or not a libstd is used.
152148
pub std: bool,
153149
}
@@ -192,7 +188,6 @@ impl<'a> ToTokens for Builder<'a> {
192188
let impl_attrs = self.impl_attrs;
193189

194190
let builder_doc_comment = &self.doc_comment;
195-
let deprecation_notes = &self.deprecation_notes.as_item();
196191

197192
#[cfg(not(feature = "clippy"))]
198193
tokens.append_all(quote!(#[allow(clippy::all)]));
@@ -217,7 +212,6 @@ impl<'a> ToTokens for Builder<'a> {
217212
#[allow(dead_code)]
218213
impl #impl_generics #builder_ident #impl_ty_generics #impl_where_clause {
219214
#(#functions)*
220-
#deprecation_notes
221215

222216
/// Create an empty builder, with all fields set to `None` or `PhantomData`.
223217
fn #create_empty() -> Self {
@@ -396,7 +390,6 @@ macro_rules! default_builder {
396390
no_alloc: false,
397391
must_derive_clone: true,
398392
doc_comment: None,
399-
deprecation_notes: DeprecationNotes::default(),
400393
std: true,
401394
}
402395
};

derive_builder_core/src/deprecation_notes.rs

Lines changed: 0 additions & 103 deletions
This file was deleted.

derive_builder_core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ mod builder;
3333
mod builder_field;
3434
mod change_span;
3535
mod default_expression;
36-
mod deprecation_notes;
3736
mod doc_comment;
3837
mod initializer;
3938
mod macro_options;
@@ -47,7 +46,6 @@ pub(crate) use builder_field::{BuilderField, BuilderFieldType};
4746
pub(crate) use change_span::change_span;
4847
use darling::FromDeriveInput;
4948
pub(crate) use default_expression::DefaultExpression;
50-
pub(crate) use deprecation_notes::DeprecationNotes;
5149
pub(crate) use doc_comment::doc_comment_from;
5250
pub(crate) use initializer::{FieldConversion, Initializer};
5351
pub(crate) use options::{BuilderPattern, Each};

derive_builder_core/src/macro_options/darling_opts.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syn::{spanned::Spanned, Attribute, Generics, Ident, Meta, Path};
1010

1111
use crate::{
1212
BlockContents, Builder, BuilderField, BuilderFieldType, BuilderPattern, DefaultExpression,
13-
DeprecationNotes, Each, FieldConversion, Initializer, Setter,
13+
Each, FieldConversion, Initializer, Setter,
1414
};
1515

1616
#[derive(Debug, Clone)]
@@ -587,9 +587,6 @@ pub struct Options {
587587

588588
#[darling(default)]
589589
field: VisibilityAttr,
590-
591-
#[darling(skip, default)]
592-
deprecation_notes: DeprecationNotes,
593590
}
594591

595592
/// Accessors for parsed properties.
@@ -689,7 +686,6 @@ impl Options {
689686
no_alloc: cfg!(not(any(feature = "alloc", feature = "lib_has_std"))),
690687
must_derive_clone: self.requires_clone(),
691688
doc_comment: None,
692-
deprecation_notes: Default::default(),
693689
std: !self.no_std.is_present(),
694690
}
695691
}
@@ -855,10 +851,6 @@ impl<'a> FieldWithDefaults<'a> {
855851
pub fn use_parent_default(&self) -> bool {
856852
self.field.default.is_none() && self.parent.default.is_some()
857853
}
858-
859-
pub fn deprecation_notes(&self) -> &DeprecationNotes {
860-
&self.parent.deprecation_notes
861-
}
862854
}
863855

864856
/// Converters to codegen structs
@@ -877,7 +869,6 @@ impl<'a> FieldWithDefaults<'a> {
877869
field_type: self.field_type(),
878870
generic_into: self.setter_into(),
879871
strip_option: self.setter_strip_option(),
880-
deprecation_notes: self.deprecation_notes(),
881872
each: self.field.setter.each.as_ref(),
882873
}
883874
}

derive_builder_core/src/setter.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::borrow::Cow;
44
use proc_macro2::{Span, TokenStream};
55
use quote::{ToTokens, TokenStreamExt};
66

7-
use crate::{BuilderFieldType, BuilderPattern, DeprecationNotes, Each};
7+
use crate::{BuilderFieldType, BuilderPattern, Each};
88

99
/// Setter for the struct fields in the build method, implementing
1010
/// `quote::ToTokens`.
@@ -62,8 +62,6 @@ pub struct Setter<'a> {
6262
/// Make the setter remove the Option wrapper from the setter, remove the need to call Some(...).
6363
/// when combined with into, the into is used on the content Type of the Option.
6464
pub strip_option: bool,
65-
/// Emit deprecation notes to the user.
66-
pub deprecation_notes: &'a DeprecationNotes,
6765
/// Emit extend method.
6866
pub each: Option<&'a Each>,
6967
}
@@ -77,7 +75,6 @@ impl<'a> ToTokens for Setter<'a> {
7775
let field_ident = self.field_ident;
7876
let ident = &self.ident;
7977
let attrs = self.attrs;
80-
let deprecation_notes = self.deprecation_notes;
8178

8279
let self_param: TokenStream;
8380
let return_ty: TokenStream;
@@ -143,7 +140,6 @@ impl<'a> ToTokens for Setter<'a> {
143140
#vis fn #ident #ty_params (#self_param, value: #param_ty)
144141
-> #return_ty
145142
{
146-
#deprecation_notes
147143
let mut new = #self_into_return_ty;
148144
new.#field_ident = #into_value;
149145
new
@@ -214,7 +210,6 @@ impl<'a> ToTokens for Setter<'a> {
214210
where
215211
#ty: #crate_root::export::core::default::Default + #crate_root::export::core::iter::Extend<VALUE>,
216212
{
217-
#deprecation_notes
218213
let mut new = #self_into_return_ty;
219214
new.#field_ident
220215
.#get_initialized_collection
@@ -299,7 +294,6 @@ macro_rules! default_setter {
299294
field_type: BuilderFieldType::Optional(Box::leak(Box::new(parse_quote!(Foo)))),
300295
generic_into: false,
301296
strip_option: false,
302-
deprecation_notes: &Default::default(),
303297
each: None,
304298
}
305299
};
@@ -508,13 +502,9 @@ mod tests {
508502
//let attrs = outer_attrs.parse_str("#[some_attr]").unwrap();
509503
let attrs: Vec<syn::Attribute> = vec![parse_quote!(#[some_attr])];
510504

511-
let mut deprecated = DeprecationNotes::default();
512-
deprecated.push("Some example.".to_string());
513-
514505
let mut setter = default_setter!();
515506
setter.attrs = attrs.as_slice();
516507
setter.generic_into = true;
517-
setter.deprecation_notes = &deprecated;
518508
setter.try_setter = true;
519509

520510
assert_eq!(
@@ -523,7 +513,6 @@ mod tests {
523513
#[some_attr]
524514
#[allow(unused_mut)]
525515
pub fn foo <VALUE: ::db::export::core::convert::Into<Foo>>(&mut self, value: VALUE) -> &mut Self {
526-
#deprecated
527516
let mut new = self;
528517
new.foo = ::db::export::core::option::Option::Some(value.into());
529518
new

0 commit comments

Comments
 (0)