File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -812,22 +812,21 @@ impl HrefResolver for DocResolver {
812
812
}
813
813
814
814
fn resolve_usage ( & self , current_resolve : UrlResolveKind ) -> Option < String > {
815
- let file = current_resolve
815
+ let ( is_main , path ) = current_resolve
816
816
. get_file ( )
817
- . map ( |short_path| & * short_path. path )
817
+ . map ( |short_path| ( short_path . is_main , & * short_path. path ) )
818
818
. unwrap_or_default ( ) ;
819
819
820
820
Some ( format ! (
821
821
"@{}/{}{}" ,
822
822
self . scope,
823
823
self . package,
824
- if file == "." { "" } else { file }
824
+ if is_main { "" } else { path }
825
825
) )
826
826
}
827
827
828
828
fn resolve_source ( & self , location : & Location ) -> Option < String > {
829
- let url =
830
- Url :: parse ( & location. filename ) . expect ( "filename was generated with Url" ) ;
829
+ let url = Url :: parse ( & location. filename ) . ok ( ) ?;
831
830
Some ( format ! (
832
831
"/@{}/{}/{}{}#L{}" ,
833
832
self . scope,
You can’t perform that action at this time.
0 commit comments