From 2969d85f5e442ef24210294ddb1a7aaf929961d8 Mon Sep 17 00:00:00 2001 From: Charlotte Meyer Date: Thu, 20 Oct 2022 13:18:23 +0000 Subject: [PATCH] fix(runtime): use unwrap not expect for unreachable code cpli says to "make illegal states unrepresentable" Acked-by: cpli --- crates/oyster_runtime/src/pipeline.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oyster_runtime/src/pipeline.rs b/crates/oyster_runtime/src/pipeline.rs index 6708110..f72f341 100644 --- a/crates/oyster_runtime/src/pipeline.rs +++ b/crates/oyster_runtime/src/pipeline.rs @@ -48,7 +48,7 @@ impl<'a> PreparedCommand<'a> { let mut words = command.0.iter().map(|word| { let mut words = word.0.iter(); - let mut s = match words.next().expect("words need to have >1 parts") { + let mut s = match words.next().unwrap() { ast::WordPart::Text(text) => Cow::from(*text), }; @@ -60,7 +60,7 @@ impl<'a> PreparedCommand<'a> { s }); - let cmd = words.next().expect("words need to have >1 parts"); + let cmd = words.next().unwrap(); let args = words.collect(); let redirect = command.1; @@ -177,7 +177,7 @@ impl Shell { let mut last_cmd = cmds .next() .map(|cmd| PreparedCommand::new(cmd, self)) - .expect("pipelines need to have >1 commands"); + .unwrap(); for cmd in cmds { let mut cmd = PreparedCommand::new(cmd, self); let (output, input) = create_pipe()?;