mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Simpify code
This commit is contained in:
parent
fb996cae6b
commit
183673655f
2 changed files with 12 additions and 16 deletions
|
@ -23,7 +23,7 @@ use proc_macro::bridge::client::TokenStream;
|
|||
use ra_proc_macro::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTask};
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap},
|
||||
fs::metadata,
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
time::SystemTime,
|
||||
};
|
||||
|
@ -50,9 +50,9 @@ impl ProcMacroSrv {
|
|||
}
|
||||
|
||||
fn expander(&mut self, path: &Path) -> Result<&dylib::Expander, String> {
|
||||
let time = metadata(path)
|
||||
.and_then(|it| it.modified())
|
||||
.map_err(|err| format!("Failed to file metadata for {}: {:?}", path.display(), err))?;
|
||||
let time = fs::metadata(path).and_then(|it| it.modified()).map_err(|err| {
|
||||
format!("Failed to get file metadata for {}: {:?}", path.display(), err)
|
||||
})?;
|
||||
|
||||
Ok(match self.expanders.entry((path.to_path_buf(), time)) {
|
||||
Entry::Vacant(v) => v.insert(dylib::Expander::new(path).map_err(|err| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue