I think this is a Clippy error, because everything works as expected, but I can't stop guessing if there is a subtle error in my code:
pub async fn run(mut self) { tracing::info!("Redis host task started"); 'exit: loop { let mut evt_connection = self.get_redis_connection().await; loop { tokio::select! { // Process messages from OPTAs. Some(msg) = self.rx.recv() => { match msg { RedisHostMessage::Shutdown => { tracing::info!("Redis host task stopped"); break 'exit; } // Other match arms that do stuff here, but no break or continue. } } result = ops::wait_event(evt_connection.as_mut()) => { match result { // As above, not break or continue here. } } } } } } async fn get_redis_connection(&self) -> Option<ConnectionManager> { match self.redis_client.get_connection_manager().await { Ok(connection) => Some(connection), Err(_) => { tracing::warn!("could not create connection to redis server"); None } } } And the Clippy error:
error: this loop never actually loops --> services/opta-receiver/src/storage/redis.rs:29:9 | 29 | / 'exit: loop { 30 | | let mut evt_connection = self.get_redis_connection().await; 31 | | loop { 32 | | tokio::select! { ... | 56 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#never_loop = note: `#[deny(clippy::never_loop)]` on by default Ideas?
3 posts - 3 participants