diff --git a/crates/arti-client/src/client.rs b/crates/arti-client/src/client.rs index aac3a3434..29a6e7bcf 100644 --- a/crates/arti-client/src/client.rs +++ b/crates/arti-client/src/client.rs @@ -313,6 +313,7 @@ impl TorClient { /// Calling this function is usually preferable to creating a /// completely separate TorClient instance, since it can share its /// internals with the existing `TorClient`. + #[must_use] pub fn isolated_client(&self) -> TorClient { let mut result = self.clone(); result.client_isolation = IsolationToken::new(); diff --git a/crates/tor-checkable/src/timed.rs b/crates/tor-checkable/src/timed.rs index 44024c450..ee8972460 100644 --- a/crates/tor-checkable/src/timed.rs +++ b/crates/tor-checkable/src/timed.rs @@ -67,12 +67,14 @@ impl TimerangeBound { /// Adjust this time-range bound to tolerate an expiration time farther /// in the future. + #[must_use] pub fn extend_tolerance(self, d: time::Duration) -> Self { let end = self.end.map(|t| t + d); Self { end, ..self } } /// Adjust this time-range bound to tolerate an initial validity /// time farther in the past. + #[must_use] pub fn extend_pre_tolerance(self, d: time::Duration) -> Self { let start = self.start.map(|t| t - d); Self { start, ..self } diff --git a/crates/tor-config/src/err.rs b/crates/tor-config/src/err.rs index 284406236..65025b2fd 100644 --- a/crates/tor-config/src/err.rs +++ b/crates/tor-config/src/err.rs @@ -40,6 +40,7 @@ impl From for ConfigBuildError { impl ConfigBuildError { /// Return a new ConfigBuildError that prefixes its field name with /// `prefix` and a dot. + #[must_use] pub fn within(&self, prefix: &str) -> Self { use ConfigBuildError::*; match self { diff --git a/crates/tor-netdoc/src/doc/netstatus.rs b/crates/tor-netdoc/src/doc/netstatus.rs index b31092a81..b2c0f4a4c 100644 --- a/crates/tor-netdoc/src/doc/netstatus.rs +++ b/crates/tor-netdoc/src/doc/netstatus.rs @@ -1386,6 +1386,7 @@ impl UnvalidatedConsensus { /// Tell the unvalidated consensus how many authorities we believe in. /// /// Without knowing this number, we can't validate the signature. + #[must_use] pub fn set_n_authorities(self, n_authorities: u16) -> Self { UnvalidatedConsensus { n_authorities: Some(n_authorities), diff --git a/crates/tor-netdoc/src/err.rs b/crates/tor-netdoc/src/err.rs index 92ca34887..bd4fd99f3 100644 --- a/crates/tor-netdoc/src/err.rs +++ b/crates/tor-netdoc/src/err.rs @@ -116,6 +116,7 @@ impl Pos { /// /// TODO: I wish I knew an efficient safe way to do this that /// guaranteed that we we always talking about the right string. + #[must_use] pub fn within(self, s: &str) -> Self { match self { Pos::Byte { off } => Self::from_offset(s, off), @@ -358,6 +359,7 @@ impl Error { /// Return a new error based on this one, with any byte-based /// position mapped to some line within a string. + #[must_use] pub fn within(mut self, s: &str) -> Error { if let Some(p) = self.pos_mut() { *p = p.within(s); @@ -367,6 +369,7 @@ impl Error { /// Return a new error based on this one, with the position (if /// any) replaced by 'p'. + #[must_use] pub fn at_pos(mut self, p: Pos) -> Error { if let Some(mypos) = self.pos_mut() { *mypos = p; @@ -376,6 +379,7 @@ impl Error { /// Return a new error based on this one, with the position (if /// replaced by 'p' if it had no position before. + #[must_use] pub fn or_at_pos(mut self, p: Pos) -> Error { if let Some(mypos) = self.pos_mut() { if *mypos == Pos::None { diff --git a/crates/tor-persist/src/testing.rs b/crates/tor-persist/src/testing.rs index e405f65da..d5bc11d3e 100644 --- a/crates/tor-persist/src/testing.rs +++ b/crates/tor-persist/src/testing.rs @@ -64,6 +64,7 @@ impl TestingStateMgr { /// Create a new unlocked [`TestingStateMgr`] that shares the same /// underlying storage with this one. + #[must_use] pub fn new_manager(&self) -> Self { let inner = self.inner.lock().expect("Lock poisoned."); let new_inner = TestingStateMgrInner {