Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bon/tests/integration/builder/attr_bon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ fn receiver_variations() {
}

#[builder]
#[allow(dead_code)]
fn mut_self_as_pin_mut_self(mut self: Pin<&mut Self>) {
#[allow(clippy::self_assignment, unused_assignments)]
#[allow(clippy::self_assignment, unused_assignments, dead_code)]
{
self = self;
}
Expand Down Expand Up @@ -132,6 +131,9 @@ fn receiver_variations() {

Sut::self_as_pin_mut_self(Pin::new(&mut sut)).call();
Pin::new(&mut sut).self_as_pin_mut_self().call();

Sut::mut_self_as_pin_mut_self(Pin::new(&mut sut)).call();
Pin::new(&mut sut).mut_self_as_pin_mut_self().call();
}

#[cfg(feature = "alloc")]
Expand Down
6 changes: 2 additions & 4 deletions bon/tests/integration/builder/attr_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ mod msrv_1_61 {
#[test]
const fn test_function() {
#[builder(const)]
#[allow(unreachable_pub)]
pub const fn sut(#[builder(getter)] _x: u32) {}
pub(crate) const fn sut(#[builder(getter)] _x: u32) {}

sut().x(1).call();
}
Expand All @@ -218,8 +217,7 @@ mod msrv_1_61 {
#[bon]
impl Sut {
#[builder(const)]
#[allow(unreachable_pub)]
pub const fn sut(#[builder(getter)] _x: u32) {}
pub(crate) const fn sut(#[builder(getter)] _x: u32) {}
}

Sut::sut().x(1).call();
Expand Down
9 changes: 6 additions & 3 deletions bon/tests/integration/builder/attr_top_level_start_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,31 +52,34 @@ fn test_method() {
fn test_function() {
{
#[builder(start_fn(name = sut_builder))]
#[allow(dead_code)]
fn sut(arg1: bool, arg2: u32) -> impl fmt::Debug {
(arg1, arg2)
}

assert_debug_eq(
sut_builder().arg1(true).arg2(42).call(),
expect!["(true, 42)"],
);
assert_debug_eq(sut(true, 42), expect!["(true, 42)"]);
}

{
#[builder(start_fn = sut_builder)]
#[allow(dead_code)]
fn sut(arg1: u32) -> u32 {
arg1
}

assert_debug_eq(sut_builder().arg1(42).call(), expect!["42"]);
assert_debug_eq(sut(42), expect!["42"]);
}

{
#[builder(start_fn(name = sut_builder, vis = ""))]
#[allow(dead_code)]
fn sut(arg1: u32) -> u32 {
arg1
}

assert_debug_eq(sut_builder().arg1(42).call(), expect!["42"]);
assert_debug_eq(sut(42), expect!["42"]);
}

Expand Down