Skip to content

Commit f42bf51

Browse files
authored
refactor: add Debug to FsCachedPath (#478)
1 parent 076cdd4 commit f42bf51

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::{Ctx, PackageJson, ResolveError, ResolveOptions, TsConfig};
88

99
#[allow(clippy::missing_errors_doc)] // trait impls should be free to return any typesafe error
1010
pub trait Cache: Sized {
11-
type Cp: CachedPath + Clone;
12-
type Pj: PackageJson;
11+
type Cp: CachedPath + Clone + Debug;
12+
type Pj: PackageJson + Debug;
1313
type Tc: TsConfig + Debug;
1414

1515
/// Clears the cache.

src/fs_cache.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::{
22
borrow::Cow,
33
cell::RefCell,
44
convert::AsRef,
5+
fmt,
56
hash::{BuildHasherDefault, Hash, Hasher},
67
io,
78
ops::Deref,
@@ -455,6 +456,12 @@ impl PartialEq for FsCachedPath {
455456

456457
impl Eq for FsCachedPath {}
457458

459+
impl fmt::Debug for FsCachedPath {
460+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
461+
f.debug_struct("FsCachedPath").field("path", &self.path).finish()
462+
}
463+
}
464+
458465
struct BorrowedCachedPath<'a> {
459466
hash: u64,
460467
path: &'a Path,

0 commit comments

Comments
 (0)