From 0ed8b97a3f3eb8a0ee1cd992d7fa42e3db893517 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 17 Aug 2022 14:29:53 +0200 Subject: [PATCH] uucore: remove panic encoding handling We never want utilities to panic on invalid input and it is not currently in use, so it can be removed safely. --- src/uucore/src/lib/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index d8860cfda..58893623d 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -153,7 +153,6 @@ pub fn execution_phrase() -> &'static str { pub enum InvalidEncodingHandling { Ignore, ConvertLossy, - Panic, } #[must_use] @@ -192,11 +191,9 @@ pub trait Args: Iterator + Sized { /// Converts each iterator item to a String and collects these into a vector /// On invalid encoding, the result will depend on the argument. This method allows to either drop entries with illegal encoding /// completely (```InvalidEncodingHandling::Ignore```), convert them using lossy-conversion (```InvalidEncodingHandling::ConvertLossy```) - /// which will result in strange strings or can chosen to panic (```InvalidEncodingHandling::Panic```). + /// which will result in strange strings or can chosen to panic. /// # Arguments /// * `handling` - This switch allows to switch the behavior, when invalid encoding is encountered - /// # Panics - /// * Occurs, when invalid encoding is encountered and handling is set to ```InvalidEncodingHandling::Panic``` fn collect_str(self, handling: InvalidEncodingHandling) -> ConversionResult { let mut full_conversion = true; let result_vector: Vec = self @@ -213,9 +210,6 @@ pub trait Args: Iterator + Sized { InvalidEncodingHandling::ConvertLossy => { Err(s_ret.to_string_lossy().into_owned()) } - InvalidEncodingHandling::Panic => { - panic!("Broken encoding found but caller cannot handle it") - } } } })