Skip to content

Commit

Permalink
Fix no-default-features compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Jun 12, 2024
1 parent 9d09742 commit d8d27e3
Show file tree
Hide file tree
Showing 14 changed files with 512 additions and 461 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Clippy
run: cargo +stable clippy --all-targets -- --deny warnings

- name: Clippy no default features
run: cargo +stable clippy --all-targets --no-default-features -- --deny warnings

- name: Clippy unstable targets
run: cargo +stable clippy --all-targets --features unstable -- --deny warnings

Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-transport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ transport_compression = []
transport_unixpipe = ["zenoh-link/transport_unixpipe"]
transport_vsock= ["zenoh-link/transport_vsock"]
stats = ["zenoh-protocol/stats"]
test = []
test = ["zenoh-protocol/test"]
unstable = []
default = ["test", "transport_multilink"]

Expand Down
3 changes: 2 additions & 1 deletion io/zenoh-transport/src/unicast/establishment/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ where
}

impl Cookie {
#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
use rand::Rng;

Expand Down Expand Up @@ -190,6 +190,7 @@ impl Cookie {

mod tests {
#[test]
#[cfg(all(test, feature = "test"))]
fn codec_cookie() {
use super::*;
use rand::{Rng, SeedableRng};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub(crate) struct StateAccept {
}

impl StateAccept {
#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
let mut rng = rand::thread_rng();
Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl StateAccept {
self.is_compression
}

#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
use rand::Rng;
let mut rng = rand::thread_rng();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl StateAccept {
self.is_lowlatency
}

#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
use rand::Rng;
let mut rng = rand::thread_rng();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl StateAccept {
self.pubkey.as_ref().map(|(_, p)| p.clone())
}

#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
let mut rng = rand::thread_rng();
let pubkey = if rng.gen_bool(0.5) {
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-transport/src/unicast/establishment/ext/qos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl StateAccept {
self.is_qos
}

#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
use rand::Rng;
let mut rng = rand::thread_rng();
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-transport/src/unicast/establishment/ext/shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl StateAccept {
self.is_shm
}

#[cfg(test)]
#[cfg(all(test, feature = "test"))]
pub(crate) fn rand() -> Self {
use rand::Rng;
let mut rng = rand::thread_rng();
Expand Down
2 changes: 2 additions & 0 deletions io/zenoh-transport/tests/unicast_authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
#![cfg(feature = "test")]

use std::{any::Any, sync::Arc, time::Duration};
use zenoh_core::{zasyncwrite, ztimeout};
use zenoh_link::Link;
Expand Down
Loading

0 comments on commit d8d27e3

Please sign in to comment.