summaryrefslogtreecommitdiffstats
path: root/vendor/derive_builder/tests/forward_allow_attr.rs
blob: 768269451358f065ca674a3894d3ebccc9ccfdbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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"
    );
}