Skip to content

Commit a348ec7

Browse files
committed
fix feature flags
1 parent c0cda96 commit a348ec7

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

iroh/src/test_utils.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ pub mod qlog {
2222
use quinn_proto::{QlogConfig, VantagePointType};
2323
use std::time::Instant;
2424

25+
#[cfg(not(feature = "qlog"))]
26+
#[derive(Debug)]
27+
pub struct QlogFileGroup;
28+
29+
#[cfg(feature = "qlog")]
2530
#[derive(Debug)]
2631
pub struct QlogFileGroup {
2732
directory: PathBuf,
@@ -43,11 +48,21 @@ pub mod qlog {
4348

4449
/// Creates a new [`QlogFileGroup`] that writes qlog files to the specified directory.
4550
pub fn new(directory: impl AsRef<Path>, title: impl ToString) -> Self {
46-
Self {
51+
#[cfg(not(feature = "qlog"))]
52+
let this = {
53+
let _ = directory;
54+
let _ = title;
55+
Self
56+
};
57+
58+
#[cfg(feature = "qlog")]
59+
let this = Self {
4760
title: title.to_string(),
4861
directory: directory.as_ref().to_owned(),
4962
start: Instant::now(),
50-
}
63+
};
64+
65+
this
5166
}
5267

5368
/// Creates a [`TransportConfig`] that emits qlog files with a client vantage point, if enabled.
@@ -57,7 +72,10 @@ pub mod qlog {
5772
/// Otherwise, a default transport config is returned.
5873
pub fn client(&self, name: impl ToString) -> Result<TransportConfig> {
5974
#[cfg(not(feature = "qlog"))]
60-
let config = Default::default();
75+
let config = {
76+
let _ = name;
77+
Default::default();
78+
};
6179

6280
#[cfg(feature = "qlog")]
6381
let config = if std::env::var("IROH_QLOG").ok().as_deref() == Some("1") {
@@ -75,7 +93,10 @@ pub mod qlog {
7593
/// Otherwise, a default transport config is returned.
7694
pub fn server(&self, name: impl ToString) -> Result<TransportConfig> {
7795
#[cfg(not(feature = "qlog"))]
78-
let config = Default::default();
96+
let config = {
97+
let _ = name;
98+
Default::default();
99+
};
79100

80101
#[cfg(feature = "qlog")]
81102
let config = if std::env::var("IROH_QLOG").ok().as_deref() == Some("1") {

0 commit comments

Comments
 (0)