From c9e90b4dd79d113514a853abd298752d87860f98 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 12 Oct 2023 19:50:06 +0200 Subject: refactor(tvix/store/fs): use while let statement Suggested by clippy. Change-Id: I686b1abcb40fab42017972a3f814fae29fa70c25 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9712 Autosubmit: flokli Reviewed-by: edef Tested-by: BuildkiteCI --- tvix/store/src/fs/fuse.rs | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/tvix/store/src/fs/fuse.rs b/tvix/store/src/fs/fuse.rs index d2a734882196..98793bf47d58 100644 --- a/tvix/store/src/fs/fuse.rs +++ b/tvix/store/src/fs/fuse.rs @@ -21,31 +21,25 @@ where FS: FileSystem + Sync + Send, { fn start(&mut self) -> io::Result<()> { - loop { - if let Some((reader, writer)) = self - .channel - .get_request() - .map_err(|_| io::Error::from_raw_os_error(libc::EINVAL))? + while let Some((reader, writer)) = self + .channel + .get_request() + .map_err(|_| io::Error::from_raw_os_error(libc::EINVAL))? + { + if let Err(e) = self + .server + .handle_message(reader, writer.into(), None, None) { - if let Err(e) = self - .server - .handle_message(reader, writer.into(), None, None) - { - match e { - // This indicates the session has been shut down. - fuse_backend_rs::Error::EncodeMessage(e) - if e.raw_os_error() == Some(BADFD) => - { - break; - } - error => { - error!(?error, "failed to handle fuse request"); - continue; - } + match e { + // This indicates the session has been shut down. + fuse_backend_rs::Error::EncodeMessage(e) if e.raw_os_error() == Some(BADFD) => { + break; + } + error => { + error!(?error, "failed to handle fuse request"); + continue; } } - } else { - break; } } Ok(()) -- cgit 1.4.1