kanidm / webauthn-rs

An implementation of webauthn components for Rustlang servers
Mozilla Public License 2.0
464 stars 79 forks source link

Fixup clippy 1.75 lints (get_first) #407

Closed micolous closed 6 months ago

micolous commented 6 months ago

I did this

cargo clippy

I expected the following

No errors.

What actually happened

error: accessing first element with `arr_x509.get(0)`
   --> webauthn-rs-core\src\attestation.rs:448:32
    |
448 |               let attestn_cert = arr_x509
    |  ________________________________^
449 | |                 .get(0)
    | |_______________________^ help: try: `arr_x509.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
note: the lint level is defined here
   --> webauthn-rs-core\src\lib.rs:16:9
    |
16  | #![deny(warnings)]
    |         ^^^^^^^^
    = note: `#[deny(clippy::get_first)]` implied by `#[deny(warnings)]`

    Checking alloc-no-stdlib v2.0.4
error: accessing first element with `arr_x509.get(0)`
   --> webauthn-rs-core\src\attestation.rs:590:33
    |
590 |       let cerificate_public_key = arr_x509
    |  _________________________________^
591 | |         .get(0)
    | |_______________^ help: try: `arr_x509.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

error: accessing first element with `arr_x509.get(0)`
   --> webauthn-rs-core\src\attestation.rs:738:20
    |
738 |       let aik_cert = arr_x509
    |  ____________________^
739 | |         .get(0)
    | |_______________^ help: try: `arr_x509.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

   Compiling heck v0.4.1
error: accessing first element with `certs.get(0)`
    --> webauthn-rs-core\src\attestation.rs:1177:29
     |
1177 |             let leaf_cert = certs.get(0).ok_or(SafetyNetError::BadCert)?;
     |                             ^^^^^^^^^^^^ help: try: `certs.first()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

    Checking clap_lex v0.4.1
    Checking strsim v0.10.0
    Checking alloc-stdlib v0.2.2
    Checking clap_builder v4.2.7
   Compiling clap_derive v4.2.0
    Checking polyval v0.6.0
   Compiling libloading v0.7.4
error: could not compile `webauthn-rs-core` (lib) due to 4 previous errors

Version (and git commit)

142e8d77335cfcd947ecc8610d45a3abfe4cd823

Operating System / Version

> rustc -Vv
rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: x86_64-pc-windows-msvc
release: 1.75.0
LLVM version: 17.0.6

Any other comments

Also fails in CI