Skip to content

Commit 695a94e

Browse files
Young-Flashzesterer
authored andcommitted
minor: cargo fmt
1 parent b1b6fb5 commit 695a94e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/source.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use super::*;
22

3+
use std::io::Error;
34
use std::{
45
collections::{hash_map::Entry, HashMap},
56
fs,
67
path::{Path, PathBuf},
78
};
8-
use std::io::Error;
99

1010
/// A trait implemented by [`Source`] caches.
1111
pub trait Cache<Id: ?Sized> {
@@ -332,9 +332,7 @@ impl Cache<Path> for FileCache {
332332
Ok::<_, Error>(match self.files.entry(path.to_path_buf()) {
333333
// TODO: Don't allocate here
334334
Entry::Occupied(entry) => entry.into_mut(),
335-
Entry::Vacant(entry) => entry.insert(Source::from(
336-
fs::read_to_string(path)?,
337-
)),
335+
Entry::Vacant(entry) => entry.insert(Source::from(fs::read_to_string(path)?)),
338336
})
339337
}
340338
fn display<'a>(&self, path: &'a Path) -> Option<impl fmt::Display + 'a> {
@@ -403,14 +401,12 @@ where
403401
I: IntoIterator<Item = (Id, S)>,
404402
S: AsRef<str>,
405403
{
406-
FnCache::new(
407-
(move |id| Err(format!("Failed to fetch source '{}'", id))) as fn(&_) -> _,
408-
)
409-
.with_sources(
410-
iter.into_iter()
411-
.map(|(id, s)| (id, Source::from(s)))
412-
.collect(),
413-
)
404+
FnCache::new((move |id| Err(format!("Failed to fetch source '{}'", id))) as fn(&_) -> _)
405+
.with_sources(
406+
iter.into_iter()
407+
.map(|(id, s)| (id, Source::from(s)))
408+
.collect(),
409+
)
414410
}
415411

416412
#[cfg(test)]

0 commit comments

Comments
 (0)