File: example_for_linting.rs

package info (click to toggle)
rust-typed-builder 0.23.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: sh: 6; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 652 bytes parent folder | download
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(clippy::all, clippy::pedantic)]
//! This example is mainly to make sure `TypedBuilder` does not do anything that triggers Clippy
//! warnings. It's not for checking behavior.

use typed_builder::TypedBuilder;

#[derive(TypedBuilder)]
struct BigStruct<'a> {
    option_with_ref: Option<&'a str>,

    #[builder(default = None)]
    option_with_default: Option<()>,
}

fn main() {
    #[allow(unused)]
    let BigStruct {
        option_with_ref: option_with_str,
        option_with_default: skipped_option,
    } = BigStruct::builder()
        .option_with_ref(Some("option with string"))
        .option_with_default(None)
        .build();
}