Skip to content

Fix Nightly Lint

Fixes "it is more idiomatic to use Option<&T> instead of &Option<T>"

» cargo +nightly clippy --all-targets --all-features -- -D warnings -Wclippy::pedantic
   Compiling securefmt v0.0.0 (/Users/robbie/Documents/projects/rust/securefmt)
error: it is more idiomatic to use `Option<&T>` instead of `&Option<T>`
   --> src/implementation/fmt_body_source.rs:99:1
    |
99  |   fn generate_struct_accessor(idx: usize, ident: &Option<Ident>) -> TokenStream {
    |   ^                                              -------------- help: change this to: `Option<&Ident>`
    |  _|
    | |
100 | |     let index: Index = idx.into();
101 | |     match &ident {
102 | |         None => quote! { self.#index },
103 | |         Some(ident) => quote! { self.#ident },
104 | |     }
105 | | }
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
    = note: `-D clippy::ref-option` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::ref_option)]`

error: could not compile `securefmt` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `securefmt` (lib) due to 1 previous error
error: could not compile `securefmt` (lib test) due to 1 previous error

Merge request reports

Loading