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.
This commit is contained in:
parent
7c44bc1aa3
commit
8d1022b1ac
1 changed files with 4 additions and 3 deletions
|
@ -54,7 +54,7 @@ pub fn fetch_config(searchpath: &PathBuf) -> Result<Value> {
|
||||||
base
|
base
|
||||||
};
|
};
|
||||||
|
|
||||||
vec![
|
let vals = vec![
|
||||||
vec![searchpath.clone()],
|
vec![searchpath.clone()],
|
||||||
gen_vars(searchpath, variants.clone(), &modifier),
|
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))
|
xdg_basedir::get_data_home().map(|data_dir| gen_vars(&data_dir, variants.clone(), &modifier))
|
||||||
.unwrap_or(vec![]),
|
.unwrap_or(vec![]),
|
||||||
].iter()
|
];
|
||||||
.flatten()
|
|
||||||
|
Itertools::flatten(vals.iter())
|
||||||
.filter(|path| path.exists() && path.is_file())
|
.filter(|path| path.exists() && path.is_file())
|
||||||
.filter_map(|path| {
|
.filter_map(|path| {
|
||||||
let content = {
|
let content = {
|
||||||
|
|
Loading…
Reference in a new issue