-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forward allow and cfg attrs to builder
If a struct is conditionally present, its builder should only be present in the same conditions. If a struct disables lints, its builder should disable the same lints. Fixes #222
- Loading branch information
Showing
4 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![deny(non_snake_case)] | ||
|
||
#[macro_use] | ||
extern crate derive_builder; | ||
|
||
#[derive(Builder)] | ||
// If this attribute is not forwarded to both the struct and the impl block, there would | ||
// be a compile error on either the field or the setter method name. Therefore, forwarding | ||
// is working as-expected if this test compiles. | ||
#[allow(non_snake_case)] | ||
pub struct Example { | ||
aPascalName: &'static str, | ||
} | ||
|
||
fn main() { | ||
assert_eq!( | ||
ExampleBuilder::default() | ||
.aPascalName("hello") | ||
.build() | ||
.unwrap() | ||
.aPascalName, | ||
"hello" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters