summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-05-11 14:32:10 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-05-11 15:45:42 +0200
commit8d1022b1ac08fd79622a57a9c5cfc16512e7e936 (patch)
treef0284619ca17db5f271828d6887befe453e145f5
parent7c44bc1aa3dfc87c15ad76ce44e2c5f31b68d4b4 (diff)
downloadimag-8d1022b1ac08fd79622a57a9c5cfc16512e7e936.zip
imag-8d1022b1ac08fd79622a57a9c5cfc16512e7e936.tar.gz
Fix: Explicitely use Itertools::flatten()
As of rustc 1.26, the `flatten()` method on iterators is preserved by the rust standard library. This could cause this code to hard-error some time in the future with the `flatten()` function actually implemented by the standard library. Hence we move to use the `Itertools::flatten()` function here explicitely.
-rw-r--r--lib/core/libimagrt/src/configuration.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/core/libimagrt/src/configuration.rs b/lib/core/libimagrt/src/configuration.rs
index 0706935..70a1311 100644
--- a/lib/core/libimagrt/src/configuration.rs
+++ b/lib/core/libimagrt/src/configuration.rs
@@ -54,7 +54,7 @@ pub fn fetch_config(searchpath: &PathBuf) -> Result<Value> {
base
};
- vec![
+ let vals = vec![
vec![searchpath.clone()],
gen_vars(searchpath, variants.clone(), &modifier),
@@ -63,8 +63,9 @@ pub fn fetch_config(searchpath: &PathBuf) -> Result<Value> {
xdg_basedir::get_data_home().map(|data_dir| gen_vars(&data_dir, variants.clone(), &modifier))
.unwrap_or(vec![]),
- ].iter()
- .flatten()
+ ];
+
+ Itertools::flatten(vals.iter())
.filter(|path| path.exists() && path.is_file())
.filter_map(|path| {
let content = {