Minify map/filter_map
This commit is contained in:
parent
fe7bde3882
commit
e7c53d84ca
1 changed files with 3 additions and 2 deletions
|
@ -245,7 +245,7 @@ fn fetch_config(rtp: &PathBuf) -> Result<Value> {
|
||||||
].iter()
|
].iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.filter(|path| path.exists() && path.is_file())
|
.filter(|path| path.exists() && path.is_file())
|
||||||
.map(|path| {
|
.filter_map(|path| if path.exists() && path.is_file() {
|
||||||
debug!("Reading {:?}", path);
|
debug!("Reading {:?}", path);
|
||||||
let content = {
|
let content = {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
|
@ -266,8 +266,9 @@ fn fetch_config(rtp: &PathBuf) -> Result<Value> {
|
||||||
.map_err(|e| REK::Instantiate.into_error_with_cause(e));
|
.map_err(|e| REK::Instantiate.into_error_with_cause(e));
|
||||||
|
|
||||||
Some(toml)
|
Some(toml)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
})
|
})
|
||||||
.filter_map(|x| x)
|
|
||||||
.filter(|loaded| loaded.is_ok())
|
.filter(|loaded| loaded.is_ok())
|
||||||
.map(|inner| Value::Table(inner.unwrap()))
|
.map(|inner| Value::Table(inner.unwrap()))
|
||||||
.nth(0)
|
.nth(0)
|
||||||
|
|
Loading…
Reference in a new issue