diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5f78388 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: [pull_request, push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: install Rust toolchain + run: rustup show active-toolchain || rustup toolchain install + - name: check + run: | + cargo check --workspace --all-features --all-targets + - name: test + run: | + cargo test --all-features --workspace + - name: lint + run: | + cargo fmt --check --all + cargo clippy --workspace --all-features --all-targets -- -Dwarnings + RUSTDOCFLAGS='-Dwarnings' cargo doc --workspace --all-features --no-deps diff --git a/src/class.rs b/src/class.rs index 720a532..1e73ed6 100644 --- a/src/class.rs +++ b/src/class.rs @@ -27,7 +27,7 @@ pub struct CtapHid<'alloc, 'pipe, 'interrupt, Bus: UsbBus> { pipe: Pipe<'alloc, 'pipe, 'interrupt, Bus>, } -impl<'alloc, 'pipe, 'interrupt, Bus> CtapHid<'alloc, 'pipe, 'interrupt, Bus> +impl<'alloc, 'pipe, Bus> CtapHid<'alloc, 'pipe, '_, Bus> where Bus: UsbBus, { @@ -218,7 +218,7 @@ pub enum ClassRequests { SetProtocol = 0xB, } -impl<'alloc, 'pipe, 'interrupt, Bus> UsbClass for CtapHid<'alloc, 'pipe, 'interrupt, Bus> +impl UsbClass for CtapHid<'_, '_, '_, Bus> where Bus: UsbBus, { diff --git a/src/lib.rs b/src/lib.rs index f57ec34..edc9474 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ usbd-ctaphid See "proposed standard": -https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb + */ diff --git a/src/pipe.rs b/src/pipe.rs index 3bf3cf7..0876284 100644 --- a/src/pipe.rs +++ b/src/pipe.rs @@ -180,7 +180,7 @@ pub struct Pipe<'alloc, 'pipe, 'interrupt, Bus: UsbBus> { pub(crate) version: crate::Version, } -impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus> { +impl<'alloc, 'pipe, Bus: UsbBus> Pipe<'alloc, 'pipe, '_, Bus> { pub(crate) fn new( read_endpoint: EndpointOut<'alloc, Bus>, write_endpoint: EndpointIn<'alloc, Bus>, @@ -316,7 +316,10 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus // `solo ls` crashes here as it uses command 0x86 Err(_) => { info!("Received invalid command."); - self.start_sending_error_on_channel(channel, AuthenticatorError::InvalidCommand); + self.start_sending_error_on_channel( + channel, + AuthenticatorError::InvalidCommand, + ); return; } }; @@ -526,11 +529,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus } _ => { - if request.command == Command::Cbor { - self.needs_keepalive = true; - } else { - self.needs_keepalive = false; - } + self.needs_keepalive = request.command == Command::Cbor; if self.interchange.state() == interchange::State::Responded { info!("dumping stale response"); self.interchange.take_response(); @@ -625,7 +624,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus message.len() ); let response = Response::from_request_and_size(request, message.len()); - self.buffer[..message.len()].copy_from_slice(&message); + self.buffer[..message.len()].copy_from_slice(message); self.start_sending(response); } }