1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 03:36:18 +00:00

Simplify invalid encoding handling into two small methods of Args

The previous encoding handling was unnecessarily complex. This commit removes the enum that specifies the handling and instead has two separate methods to collect the strings either with lossy conversion or by ignoring invalidly encoded strings.
This commit is contained in:
Terts Diepraam 2022-08-17 15:20:20 +02:00
parent 5621502a95
commit ba713b6365
48 changed files with 107 additions and 153 deletions

View file

@ -30,7 +30,7 @@ use std::rc::Rc;
use std::thread::sleep;
use std::time::Duration;
use tempfile::TempDir;
use uucore::{Args, InvalidEncodingHandling};
use uucore::Args;
#[cfg(windows)]
static PROGNAME: &str = concat!(env!("CARGO_PKG_NAME"), ".exe");
@ -1021,7 +1021,7 @@ impl UCommand {
let strings = args
.iter()
.map(|s| s.as_ref().to_os_string())
.collect_str(InvalidEncodingHandling::Ignore);
.collect_ignore();
for s in strings {
self.comm_string.push(' ');