Skip to content

Commit ae3bbaa

Browse files
committed
clippy: tracing: allow needless_borrow on record
tracing-attributes 0.1.23 ships with a smarter `Span::record` that allows owned values [^1], which makes This means that previously invalid code such as: span.record("num_updates", num_items); Is now valid, which makes clippy throw a warning for needless_borrow Fixing the lint, however, means that foca would require a strict version check for tracing-attributes (otherwise anything pulling 0.1.22 or bellow would not compile anymore). I don't want a strict dependency on tracing: it's tangential do foca and I'd like users to benefit from the improvements that might be shipped along, so I fix the lint warning by ignoring it instead. Once we get a (at least minor) version bump on `tracing`, this can be removed and updated to skip the borrow. [^1]: tokio-rs/tracing#2212
1 parent 202c8c6 commit ae3bbaa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,7 @@ where
11521152
// Seek back and write the correct number of items added
11531153
buf.get_mut()[tally_position..].as_mut().put_u16(num_items);
11541154
#[cfg(feature = "tracing")]
1155+
#[allow(clippy::needless_borrow)]
11551156
span.record("num_updates", &num_items);
11561157
}
11571158

@@ -1168,11 +1169,13 @@ where
11681169
#[cfg_attr(not(feature = "tracing"), allow(unused_variables))]
11691170
let num_broadcasts = self.custom_broadcasts.fill(&mut buf, usize::MAX);
11701171
#[cfg(feature = "tracing")]
1172+
#[allow(clippy::needless_borrow)]
11711173
span.record("num_broadcasts", &num_broadcasts);
11721174
}
11731175

11741176
let data = buf.into_inner();
11751177
#[cfg(feature = "tracing")]
1178+
#[allow(clippy::needless_borrow)]
11761179
span.record("len", &data.len());
11771180

11781181
#[cfg(feature = "tracing")]

0 commit comments

Comments
 (0)