@@ -93,13 +93,13 @@ pub struct JsFileSystem {
93
93
}
94
94
95
95
impl FileSystem for JsFileSystem {
96
- fn canonicalize < P : AsRef < Path > > (
96
+ fn canonicalize (
97
97
& self ,
98
- path : P ,
98
+ path : & Path ,
99
99
_cache : & DashMap < PathBuf , Option < PathBuf > > ,
100
100
) -> std:: io:: Result < std:: path:: PathBuf > {
101
101
let canonicalize = || -> napi:: Result < _ > {
102
- let path = path. as_ref ( ) . to_string_lossy ( ) ;
102
+ let path = path. to_string_lossy ( ) ;
103
103
let path = self . canonicalize . env . create_string ( path. as_ref ( ) ) ?;
104
104
let res: JsString = self . canonicalize . get ( ) ?. call ( None , & [ path] ) ?. try_into ( ) ?;
105
105
let utf8 = res. into_utf8 ( ) ?;
@@ -109,9 +109,9 @@ impl FileSystem for JsFileSystem {
109
109
canonicalize ( ) . map_err ( |err| std:: io:: Error :: new ( std:: io:: ErrorKind :: NotFound , err. to_string ( ) ) )
110
110
}
111
111
112
- fn read_to_string < P : AsRef < Path > > ( & self , path : P ) -> std:: io:: Result < String > {
112
+ fn read_to_string ( & self , path : & Path ) -> std:: io:: Result < String > {
113
113
let read = || -> napi:: Result < _ > {
114
- let path = path. as_ref ( ) . to_string_lossy ( ) ;
114
+ let path = path. to_string_lossy ( ) ;
115
115
let path = self . read . env . create_string ( path. as_ref ( ) ) ?;
116
116
let res: JsBuffer = self . read . get ( ) ?. call ( None , & [ path] ) ?. try_into ( ) ?;
117
117
let value = res. into_value ( ) ?;
@@ -121,9 +121,9 @@ impl FileSystem for JsFileSystem {
121
121
read ( ) . map_err ( |err| std:: io:: Error :: new ( std:: io:: ErrorKind :: NotFound , err. to_string ( ) ) )
122
122
}
123
123
124
- fn is_file < P : AsRef < Path > > ( & self , path : P ) -> bool {
124
+ fn is_file ( & self , path : & Path ) -> bool {
125
125
let is_file = || -> napi:: Result < _ > {
126
- let path = path. as_ref ( ) . to_string_lossy ( ) ;
126
+ let path = path. to_string_lossy ( ) ;
127
127
let p = self . is_file . env . create_string ( path. as_ref ( ) ) ?;
128
128
let res: JsBoolean = self . is_file . get ( ) ?. call ( None , & [ p] ) ?. try_into ( ) ?;
129
129
res. get_value ( )
@@ -132,9 +132,9 @@ impl FileSystem for JsFileSystem {
132
132
is_file ( ) . unwrap_or ( false )
133
133
}
134
134
135
- fn is_dir < P : AsRef < Path > > ( & self , path : P ) -> bool {
135
+ fn is_dir ( & self , path : & Path ) -> bool {
136
136
let is_dir = || -> napi:: Result < _ > {
137
- let path = path. as_ref ( ) . to_string_lossy ( ) ;
137
+ let path = path. to_string_lossy ( ) ;
138
138
let path = self . is_dir . env . create_string ( path. as_ref ( ) ) ?;
139
139
let res: JsBoolean = self . is_dir . get ( ) ?. call ( None , & [ path] ) ?. try_into ( ) ?;
140
140
res. get_value ( )
@@ -153,9 +153,9 @@ enum EitherFs<A, B> {
153
153
154
154
#[ cfg( not( target_arch = "wasm32" ) ) ]
155
155
impl < A : FileSystem , B : FileSystem > FileSystem for EitherFs < A , B > {
156
- fn canonicalize < P : AsRef < Path > > (
156
+ fn canonicalize (
157
157
& self ,
158
- path : P ,
158
+ path : & Path ,
159
159
cache : & DashMap < PathBuf , Option < PathBuf > > ,
160
160
) -> std:: io:: Result < std:: path:: PathBuf > {
161
161
match self {
@@ -164,21 +164,21 @@ impl<A: FileSystem, B: FileSystem> FileSystem for EitherFs<A, B> {
164
164
}
165
165
}
166
166
167
- fn read_to_string < P : AsRef < Path > > ( & self , path : P ) -> std:: io:: Result < String > {
167
+ fn read_to_string ( & self , path : & Path ) -> std:: io:: Result < String > {
168
168
match self {
169
169
EitherFs :: A ( a) => a. read_to_string ( path) ,
170
170
EitherFs :: B ( b) => b. read_to_string ( path) ,
171
171
}
172
172
}
173
173
174
- fn is_file < P : AsRef < Path > > ( & self , path : P ) -> bool {
174
+ fn is_file ( & self , path : & Path ) -> bool {
175
175
match self {
176
176
EitherFs :: A ( a) => a. is_file ( path) ,
177
177
EitherFs :: B ( b) => b. is_file ( path) ,
178
178
}
179
179
}
180
180
181
- fn is_dir < P : AsRef < Path > > ( & self , path : P ) -> bool {
181
+ fn is_dir ( & self , path : & Path ) -> bool {
182
182
match self {
183
183
EitherFs :: A ( a) => a. is_dir ( path) ,
184
184
EitherFs :: B ( b) => b. is_dir ( path) ,
0 commit comments