@@ -169,18 +169,18 @@ impl<D> GraphEdges<D> {
169169 }
170170
171171 /// Returns all files imported by the given file
172- pub fn imports ( & self , file : & Path ) -> HashSet < & PathBuf > {
172+ pub fn imports ( & self , file : & Path ) -> HashSet < & Path > {
173173 if let Some ( start) = self . indices . get ( file) . copied ( ) {
174- NodesIter :: new ( start, self ) . skip ( 1 ) . map ( move |idx| & self . rev_indices [ & idx] ) . collect ( )
174+ NodesIter :: new ( start, self ) . skip ( 1 ) . map ( move |idx| & * self . rev_indices [ & idx] ) . collect ( )
175175 } else {
176176 HashSet :: new ( )
177177 }
178178 }
179179
180180 /// Returns all files that import the given file
181- pub fn importers ( & self , file : & Path ) -> HashSet < & PathBuf > {
181+ pub fn importers ( & self , file : & Path ) -> HashSet < & Path > {
182182 if let Some ( start) = self . indices . get ( file) . copied ( ) {
183- self . rev_edges [ start] . iter ( ) . map ( move |idx| & self . rev_indices [ idx] ) . collect ( )
183+ self . rev_edges [ start] . iter ( ) . map ( move |idx| & * self . rev_indices [ idx] ) . collect ( )
184184 } else {
185185 HashSet :: new ( )
186186 }
@@ -192,7 +192,7 @@ impl<D> GraphEdges<D> {
192192 }
193193
194194 /// Returns the path of the given node
195- pub fn node_path ( & self , id : usize ) -> & PathBuf {
195+ pub fn node_path ( & self , id : usize ) -> & Path {
196196 & self . rev_indices [ & id]
197197 }
198198
@@ -327,7 +327,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
327327 }
328328
329329 /// Returns all files imported by the given file
330- pub fn imports ( & self , path : & Path ) -> HashSet < & PathBuf > {
330+ pub fn imports ( & self , path : & Path ) -> HashSet < & Path > {
331331 self . edges . imports ( path)
332332 }
333333
@@ -1121,7 +1121,7 @@ impl<D: ParsedSource> Node<D> {
11211121 & self . source . content
11221122 }
11231123
1124- pub fn unpack ( & self ) -> ( & PathBuf , & Source ) {
1124+ pub fn unpack ( & self ) -> ( & Path , & Source ) {
11251125 ( & self . path , & self . source )
11261126 }
11271127}
@@ -1199,8 +1199,8 @@ mod tests {
11991199 let dapp_test = graph. node ( 1 ) ;
12001200 assert_eq ! ( dapp_test. path, paths. sources. join( "Dapp.t.sol" ) ) ;
12011201 assert_eq ! (
1202- dapp_test. data. imports. iter( ) . map( |i| i. data( ) . path( ) ) . collect:: <Vec <& PathBuf >>( ) ,
1203- vec![ & PathBuf :: from ( "ds-test/test.sol" ) , & PathBuf :: from ( "./Dapp.sol" ) ]
1202+ dapp_test. data. imports. iter( ) . map( |i| i. data( ) . path( ) ) . collect:: <Vec <& Path >>( ) ,
1203+ vec![ Path :: new ( "ds-test/test.sol" ) , Path :: new ( "./Dapp.sol" ) ]
12041204 ) ;
12051205 assert_eq ! ( graph. imported_nodes( 1 ) . to_vec( ) , vec![ 2 , 0 ] ) ;
12061206 }
0 commit comments