Skip to content

Commit b4c9a8d

Browse files
committed
refactor: drop string from SpuriousRateLimiterEvent erro variant
The variant was only constructed in a single place, so just make the string that was passed there the display text for this error. Signed-off-by: Patrick Roy <[email protected]>
1 parent 4a21dc6 commit b4c9a8d

File tree

1 file changed

+3
-5
lines changed
  • src/vmm/src/rate_limiter

1 file changed

+3
-5
lines changed

src/vmm/src/rate_limiter/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ pub mod persist;
1212
#[derive(Debug, thiserror::Error, displaydoc::Display)]
1313
/// Describes the errors that may occur while handling rate limiter events.
1414
pub enum RateLimiterError {
15-
/// The event handler was called spuriously: {0}
16-
SpuriousRateLimiterEvent(&'static str),
15+
/// Rate limiter event handler called without a present timer
16+
SpuriousRateLimiterEvent,
1717
}
1818

1919
// Interval at which the refill timer will run when limiter is at capacity.
@@ -470,9 +470,7 @@ impl RateLimiter {
470470
/// If the rate limiter is disabled or is not blocked, an error is returned.
471471
pub fn event_handler(&mut self) -> Result<(), RateLimiterError> {
472472
match self.timer_fd.read() {
473-
0 => Err(RateLimiterError::SpuriousRateLimiterEvent(
474-
"Rate limiter event handler called without a present timer",
475-
)),
473+
0 => Err(RateLimiterError::SpuriousRateLimiterEvent),
476474
_ => {
477475
self.timer_active = false;
478476
Ok(())

0 commit comments

Comments
 (0)