Try again with math-like externals (#4629)

* Try again with math-like externals

* clippy 1.59

* clippy 1.59

* clippy 1.59
This commit is contained in:
JT
2022-02-24 14:02:28 -05:00
committed by GitHub
parent 2c9d8c4818
commit 3c62d27c28
21 changed files with 77 additions and 54 deletions

View File

@ -259,7 +259,7 @@ impl PipelineData {
}
/// Simplified flatmapper. For full iterator support use `.into_iter()` instead
pub fn flat_map<U, F>(
pub fn flat_map<U: 'static, F>(
self,
mut f: F,
ctrlc: Option<Arc<AtomicBool>>,
@ -272,10 +272,10 @@ impl PipelineData {
{
match self {
PipelineData::Value(Value::List { vals, .. }, ..) => {
Ok(vals.into_iter().map(f).flatten().into_pipeline_data(ctrlc))
Ok(vals.into_iter().flat_map(f).into_pipeline_data(ctrlc))
}
PipelineData::ListStream(stream, ..) => {
Ok(stream.map(f).flatten().into_pipeline_data(ctrlc))
Ok(stream.flat_map(f).into_pipeline_data(ctrlc))
}
PipelineData::RawStream(stream, ..) => {
let collected = stream.into_bytes()?;
@ -297,7 +297,7 @@ impl PipelineData {
}
}
PipelineData::Value(Value::Range { val, .. }, ..) => match val.into_range_iter() {
Ok(iter) => Ok(iter.map(f).flatten().into_pipeline_data(ctrlc)),
Ok(iter) => Ok(iter.flat_map(f).into_pipeline_data(ctrlc)),
Err(error) => Err(error),
},
PipelineData::Value(v, ..) => Ok(f(v).into_iter().into_pipeline_data(ctrlc)),

View File

@ -2120,7 +2120,7 @@ fn format_filesize(num_bytes: i64, config: &Config) -> String {
// Since get_locale() and Locale::from_name() don't always return the same items
// we need to try and parse it to match. For instance, a valid locale is de_DE
// however Locale::from_name() wants only de so we split and parse it out.
let locale_string = locale_string.replace("_", "-"); // en_AU -> en-AU
let locale_string = locale_string.replace('_', "-"); // en_AU -> en-AU
let locale = match Locale::from_name(&locale_string) {
Ok(loc) => loc,
_ => {