File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -199,16 +199,17 @@ fn convert_dependencies(pkg: &Package) -> Vec<(String, String)> {
199199
200200/// Reads readme if there is any read defined in Cargo.toml of a Package
201201fn get_readme ( pkg : & Package ) -> Result < Option < String > > {
202- if pkg. manifest ( ) . metadata ( ) . readme . is_some ( ) {
203- let readme_path = PathBuf :: from ( try!( source_path ( & pkg) . ok_or ( "File not found" ) ) )
204- . join ( pkg. manifest ( ) . metadata ( ) . readme . clone ( ) . unwrap ( ) ) ;
205- let mut reader = try!( fs:: File :: open ( readme_path) . map ( |f| BufReader :: new ( f) ) ) ;
206- let mut readme = String :: new ( ) ;
207- reader. read_to_string ( & mut readme) . unwrap ( ) ;
208- Ok ( Some ( readme) )
209- } else {
210- Ok ( None )
202+ let readme_path = PathBuf :: from ( try!( source_path ( & pkg) . ok_or ( "File not found" ) ) )
203+ . join ( pkg. manifest ( ) . metadata ( ) . readme . clone ( ) . unwrap_or ( "README.md" . to_owned ( ) ) ) ;
204+
205+ if !readme_path. exists ( ) {
206+ return Ok ( None ) ;
211207 }
208+
209+ let mut reader = try!( fs:: File :: open ( readme_path) . map ( |f| BufReader :: new ( f) ) ) ;
210+ let mut readme = String :: new ( ) ;
211+ try!( reader. read_to_string ( & mut readme) ) ;
212+ Ok ( Some ( readme) )
212213}
213214
214215
You can’t perform that action at this time.
0 commit comments