Don't care about needless return value of closures
This commit is contained in:
parent
5cca66b346
commit
5e30bede40
37
src/main.rs
37
src/main.rs
@ -104,26 +104,23 @@ Then try to restart Plume.
|
|||||||
let mut open_searcher =
|
let mut open_searcher =
|
||||||
UnmanagedSearcher::open(&CONFIG.search_index, &CONFIG.search_tokenizers);
|
UnmanagedSearcher::open(&CONFIG.search_index, &CONFIG.search_tokenizers);
|
||||||
if let Err(Error::Search(SearcherError::InvalidIndexDataError)) = open_searcher {
|
if let Err(Error::Search(SearcherError::InvalidIndexDataError)) = open_searcher {
|
||||||
UnmanagedSearcher::create(&CONFIG.search_index, &CONFIG.search_tokenizers)
|
if UnmanagedSearcher::create(&CONFIG.search_index, &CONFIG.search_tokenizers).is_err() {
|
||||||
.or_else(|_| {
|
let current_path = Path::new(&CONFIG.search_index);
|
||||||
let current_path = Path::new(&CONFIG.search_index);
|
let backup_path = format!("{}.{}", ¤t_path.display(), Utc::now().timestamp());
|
||||||
let backup_path = format!("{}.{}", ¤t_path.display(), Utc::now().timestamp());
|
let backup_path = Path::new(&backup_path);
|
||||||
let backup_path = Path::new(&backup_path);
|
fs::rename(current_path, backup_path)
|
||||||
fs::rename(current_path, backup_path)
|
.expect("main: error on backing up search index directory for recreating");
|
||||||
.expect("main: error on backing up search index directory for recreating");
|
if UnmanagedSearcher::create(&CONFIG.search_index, &CONFIG.search_tokenizers).is_ok() {
|
||||||
UnmanagedSearcher::create(&CONFIG.search_index, &CONFIG.search_tokenizers).and_then(
|
if fs::remove_dir_all(backup_path).is_err() {
|
||||||
|searcher| {
|
eprintln!(
|
||||||
if fs::remove_dir_all(backup_path).is_err() {
|
"error on removing backup directory: {}. it remains",
|
||||||
eprintln!(
|
backup_path.display()
|
||||||
"error on removing backup directory: {}. it remains",
|
);
|
||||||
backup_path.display()
|
}
|
||||||
);
|
} else {
|
||||||
}
|
panic!("main: error on recreating search index in new index format. remove search index and run `plm search init` manually");
|
||||||
Ok(searcher)
|
}
|
||||||
},
|
}
|
||||||
)
|
|
||||||
})
|
|
||||||
.expect("main: error on recreating search index in new index format. remove search index and run `plm search init` manually");
|
|
||||||
open_searcher = UnmanagedSearcher::open(&CONFIG.search_index, &CONFIG.search_tokenizers);
|
open_searcher = UnmanagedSearcher::open(&CONFIG.search_index, &CONFIG.search_tokenizers);
|
||||||
}
|
}
|
||||||
#[allow(clippy::match_wild_err_arm)]
|
#[allow(clippy::match_wild_err_arm)]
|
||||||
|
Loading…
Reference in New Issue
Block a user