Skip to content

Commit 0351c25

Browse files
committed
Improvements to the CI coverage; fixes where the coverage would throw warnings.
1 parent 6bcfb00 commit 0351c25

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
**/target
22
**/target_ci
33
Cargo.lock
4-
.idea
4+
.idea
5+
6+
# Created if running 'cargo test', locally
7+
/tests/

ci.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@ cargo batch \
4545
# --- build --release --manifest-path examples/apache-nimble/Cargo.toml --target thumbv7em-none-eabihf
4646

4747
cargo fmt --check --manifest-path ./host/Cargo.toml
48-
cargo clippy --manifest-path ./host/Cargo.toml --features gatt,peripheral,central
48+
cargo fmt --check --manifest-path ./host-macros/Cargo.toml
49+
50+
cargo clippy --manifest-path ./host/Cargo.toml --features central,gatt,peripheral,scan,security
51+
cargo clippy --manifest-path ./host-macros/Cargo.toml
52+
4953
cargo test --manifest-path ./host/Cargo.toml --lib -- --nocapture
50-
cargo test --manifest-path ./host/Cargo.toml --no-run -- --nocapture
51-
cargo test --manifest-path ./examples/tests/Cargo.toml --no-run -- --nocapture
54+
cargo test --manifest-path ./host/Cargo.toml --no-run
55+
#cargo test --manifest-path ./host/Cargo.toml --features central,gatt,peripheral,scan,security --lib -- --nocapture
56+
# Fails with:
57+
# thread 'security_manager::pairing::peripheral::tests::just_works_with_irk_distribution' panicked at src/security_manager/pairing/peripheral.rs:911:13:
58+
# assertion failed: pairing_data.local_features.responder_key_distribution.identity_key()
59+
60+
cargo test --manifest-path ./host/Cargo.toml --features central,gatt,peripheral,scan,security --no-run
61+
cargo test --manifest-path ./host-macros/Cargo.toml --lib -- --nocapture
62+
cargo test --manifest-path ./examples/tests/Cargo.toml --no-run

host-macros/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ pub fn gatt_service(args: TokenStream, item: TokenStream) -> TokenStream {
110110
// If there was an error parsing the characteristics, return the error
111111
if let Some(err) = err {
112112
let desc = err.to_string();
113+
#[allow(clippy::uninlined_format_args)]
113114
ctxt.error_spanned_by(
114115
err.into_compile_error(),
115116
format!("Parsing characteristics was unsuccessful:\n{}", desc),
@@ -249,5 +250,6 @@ fn check_for_characteristic(
249250
#[proc_macro]
250251
pub fn uuid(args: TokenStream) -> TokenStream {
251252
let uuid = parse_macro_input!(args as uuid::UuidArgs);
253+
#[allow(clippy::needless_return)]
252254
return uuid.uuid.into();
253255
}

host-macros/src/uuid.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use core::str::FromStr;
77
use darling::{Error, FromMeta};
88
use proc_macro2::TokenStream as TokenStream2;
99
use quote::quote;
10-
use syn::{parse::Result, spanned::Spanned, Expr};
10+
use syn::parse::Result;
11+
use syn::spanned::Spanned;
12+
use syn::Expr;
1113

1214
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
1315
pub enum Uuid {

host/src/scan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'d, C: Controller, P: PacketPool> Scanner<'d, C, P> {
128128
deadline: if config.timeout.as_ticks() == 0 {
129129
None
130130
} else {
131-
Some(Instant::now() + config.timeout.into())
131+
Some(Instant::now() + config.timeout)
132132
},
133133
done: false,
134134
})

host/src/security_manager/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ impl<const BOND_COUNT: usize> SecurityManager<BOND_COUNT> {
567567
event: LeEventPacket,
568568
connections: &ConnectionManager<'_, P>,
569569
) -> Result<(), Error> {
570+
#[allow(clippy::single_match)]
570571
match event.kind {
571572
LeEventKind::LeLongTermKeyRequest => {
572573
let event_data = LeLongTermKeyRequest::from_hci_bytes_complete(event.data)?;
@@ -583,6 +584,7 @@ impl<const BOND_COUNT: usize> SecurityManager<BOND_COUNT> {
583584
event: EventPacket,
584585
connections: &ConnectionManager<'_, P>,
585586
) -> Result<(), Error> {
587+
#[allow(clippy::single_match)]
586588
match event.kind {
587589
EventKind::EncryptionChangeV1 => {
588590
let event_data = EncryptionChangeV1::from_hci_bytes_complete(event.data)?;

0 commit comments

Comments
 (0)