Skip to content

Commit 6edcb14

Browse files
Add CI workflow
1 parent dcff900 commit 6edcb14

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: ci
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: install Rust toolchain
11+
run: rustup show active-toolchain || rustup toolchain install
12+
- name: check
13+
run: |
14+
cargo check --workspace --all-features --all-targets
15+
- name: test
16+
run: |
17+
cargo test --all-features --workspace
18+
- name: lint
19+
run: |
20+
cargo fmt --check --all
21+
cargo clippy --workspace --all-features --all-targets -- -Dwarnings
22+
RUSTDOCFLAGS='-Dwarnings' cargo doc --workspace --all-features --no-deps

src/class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct CtapHid<'alloc, 'pipe, 'interrupt, Bus: UsbBus> {
2727
pipe: Pipe<'alloc, 'pipe, 'interrupt, Bus>,
2828
}
2929

30-
impl<'alloc, 'pipe, 'interrupt, Bus> CtapHid<'alloc, 'pipe, 'interrupt, Bus>
30+
impl<'alloc, 'pipe, Bus> CtapHid<'alloc, 'pipe, '_, Bus>
3131
where
3232
Bus: UsbBus,
3333
{
@@ -218,7 +218,7 @@ pub enum ClassRequests {
218218
SetProtocol = 0xB,
219219
}
220220

221-
impl<'alloc, 'pipe, 'interrupt, Bus> UsbClass<Bus> for CtapHid<'alloc, 'pipe, 'interrupt, Bus>
221+
impl<Bus> UsbClass<Bus> for CtapHid<'_, '_, '_, Bus>
222222
where
223223
Bus: UsbBus,
224224
{

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
usbd-ctaphid
55
66
See "proposed standard":
7-
https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb
7+
<https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb>
88
99
*/
1010

src/pipe.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub struct Pipe<'alloc, 'pipe, 'interrupt, Bus: UsbBus> {
180180
pub(crate) version: crate::Version,
181181
}
182182

183-
impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus> {
183+
impl<'alloc, 'pipe, Bus: UsbBus> Pipe<'alloc, 'pipe, '_, Bus> {
184184
pub(crate) fn new(
185185
read_endpoint: EndpointOut<'alloc, Bus>,
186186
write_endpoint: EndpointIn<'alloc, Bus>,
@@ -316,7 +316,10 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
316316
// `solo ls` crashes here as it uses command 0x86
317317
Err(_) => {
318318
info!("Received invalid command.");
319-
self.start_sending_error_on_channel(channel, AuthenticatorError::InvalidCommand);
319+
self.start_sending_error_on_channel(
320+
channel,
321+
AuthenticatorError::InvalidCommand,
322+
);
320323
return;
321324
}
322325
};
@@ -526,11 +529,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
526529
}
527530

528531
_ => {
529-
if request.command == Command::Cbor {
530-
self.needs_keepalive = true;
531-
} else {
532-
self.needs_keepalive = false;
533-
}
532+
self.needs_keepalive = request.command == Command::Cbor;
534533
if self.interchange.state() == interchange::State::Responded {
535534
info!("dumping stale response");
536535
self.interchange.take_response();
@@ -625,7 +624,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
625624
message.len()
626625
);
627626
let response = Response::from_request_and_size(request, message.len());
628-
self.buffer[..message.len()].copy_from_slice(&message);
627+
self.buffer[..message.len()].copy_from_slice(message);
629628
self.start_sending(response);
630629
}
631630
}

0 commit comments

Comments
 (0)