Address all occurrences of statement expression attributes

This commit is contained in:
Julien Cretin
2022-03-28 16:29:22 +02:00
parent 6e2f076e24
commit f862d4cc18
3 changed files with 15 additions and 21 deletions

View File

@@ -1173,10 +1173,8 @@ impl CtapState {
String::from(FIDO2_1_VERSION_STRING),
];
#[cfg(feature = "with_ctap1")]
{
if !has_always_uv {
versions.insert(0, String::from(U2F_VERSION_STRING))
}
if !has_always_uv {
versions.insert(0, String::from(U2F_VERSION_STRING))
}
let mut options = vec![];
if ENTERPRISE_ATTESTATION_MODE.is_some() {
@@ -1246,6 +1244,8 @@ impl CtapState {
self.client_pin.reset(env.rng());
#[cfg(feature = "with_ctap1")]
{
// We create a block statement to wrap this assignment expression, because attributes
// (like #[cfg]) are not supported on expressions.
self.u2f_up_state = U2fUserPresenceState::new(U2F_UP_PROMPT_TIMEOUT, TOUCH_TIMEOUT);
}
Ok(ResponseData::AuthenticatorReset)

View File

@@ -82,8 +82,8 @@ fn main() {
});
#[cfg(feature = "with_ctap1")]
let mut buttons = buttons_callback.init().flex_unwrap();
#[cfg(feature = "with_ctap1")]
// At the moment, all buttons are accepted. You can customize your setup here.
#[cfg(feature = "with_ctap1")]
for mut button in &mut buttons {
button.enable().flex_unwrap();
}
@@ -168,14 +168,12 @@ fn main() {
#[cfg(not(feature = "with_ctap1"))]
switch_off_leds();
#[cfg(feature = "with_ctap1")]
{
if ctap.state().u2f_needs_user_presence(now) {
// Flash the LEDs with an almost regular pattern. The inaccuracy comes from
// delay caused by processing and sending of packets.
blink_leds(led_counter);
} else {
switch_off_leds();
}
if ctap.state().u2f_needs_user_presence(now) {
// Flash the LEDs with an almost regular pattern. The inaccuracy comes from
// delay caused by processing and sending of packets.
blink_leds(led_counter);
} else {
switch_off_leds();
}
}
}