Skip to content

Commit

Permalink
Small cleanup (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Veetaha authored Aug 11, 2024
1 parent 0b04f47 commit d11550f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ unused_macro_rules = "warn"
unused_qualifications = "warn"
variant_size_differences = "warn"

rust_2024_compatibility = { level = "warn", priority = 1 }

# Unstable but desirable lints.
# [workspace.lints.rust]
# must_not_suspend = "warn"
Expand Down
2 changes: 1 addition & 1 deletion bon-macros/src/builder/builder_gen/input_func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ struct FnCallBody {
}

impl FinishFuncBody for FnCallBody {
fn gen(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2 {
fn generate(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2 {
let asyncness = &self.func.sig.asyncness;
let maybe_await = asyncness.is_some().then(|| quote!(.await));

Expand Down
2 changes: 1 addition & 1 deletion bon-macros/src/builder/builder_gen/input_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct StructLiteralBody {
}

impl FinishFuncBody for StructLiteralBody {
fn gen(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2 {
fn generate(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2 {
let Self { struct_ident } = self;

let member_exprs = member_exprs.iter().map(|MemberExpr { member, expr }| {
Expand Down
4 changes: 2 additions & 2 deletions bon-macros/src/builder/builder_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) struct StartFunc {

pub(crate) trait FinishFuncBody {
/// Generate `finish` function body from ready-made expressions.
fn gen(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2;
fn generate(&self, member_exprs: &[MemberExpr<'_>]) -> TokenStream2;
}

pub(crate) struct MemberExpr<'a> {
Expand Down Expand Up @@ -454,7 +454,7 @@ impl BuilderGenCtx {
.map(|member| self.member_expr(member))
.try_collect()?;

let body = &self.finish_func.body.gen(&member_exprs);
let body = &self.finish_func.body.generate(&member_exprs);
let asyncness = &self.finish_func.asyncness;
let unsafety = &self.finish_func.unsafety;
let docs = &self.finish_func.docs;
Expand Down
2 changes: 1 addition & 1 deletion website/docs/guide/alternatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Why is there an explicit `main()` function in this code snippet 🤔? It's a lon

:::

This feature isn't available today in `bon`, but it's planned for the future. However, it won't be enabled by default, but rather be opt-in like it is in `derive-builder`.
This feature isn't available today in `bon`, but it's planned for the future. However, it won't be enabled by default, but rather be opt-in like it is in `derive_builder`.

The problem of this feature is that a setter that pushes an element into a collection like that may confuse the reader in case if only one element is pushed. This may hide the fact that the member is actually a collection called `friends` in plural. However, this feature is still useful to provide backwards-compatibility when changing the type of a member from `T` or `Option<T>` to `Collection<T>`.

Expand Down
17 changes: 0 additions & 17 deletions website/docs/guide/conditional-compilation.md

This file was deleted.

0 comments on commit d11550f

Please sign in to comment.