Skip to content

Commit a4bc844

Browse files
committed
refactor: simplify
1 parent f0c5548 commit a4bc844

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,19 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
681681
Ok(None)
682682
}
683683

684-
async fn load_realpath(&self, cached_path: &CachedPath, ctx: &mut Ctx) -> Result<PathBuf, ResolveError> {
684+
async fn load_realpath(
685+
&self,
686+
cached_path: &CachedPath,
687+
ctx: &mut Ctx,
688+
) -> Result<PathBuf, ResolveError> {
685689
if self.options.symlinks {
686690
cached_path
687691
.realpath(&self.cache.fs)
688692
.await
689-
.and_then(
690-
|path| {
691-
ctx.add_file_dependency(&path);
692-
Ok(path)
693-
}
694-
)
693+
.map(|path| {
694+
ctx.add_file_dependency(&path);
695+
path
696+
})
695697
.map_err(ResolveError::from)
696698
} else {
697699
Ok(cached_path.to_path_buf())

src/tests/symlink.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ async fn test() -> io::Result<()> {
147147
.await
148148
.map(|r| r.full_path());
149149
assert_eq!(resolved_path, Ok(path.join(request)));
150-
assert_eq!(
150+
assert!(
151151
ctx.file_dependencies.contains(&resolved_path.unwrap()),
152-
true,
153152
"file dependencies should contain resolved path {comment:?}"
154153
);
155154
}

0 commit comments

Comments
 (0)