From b23390b27f32c8935e1dc796a70a6e49a92fbc56 Mon Sep 17 00:00:00 2001 From: Tarun Verghis Date: Sat, 16 May 2020 23:24:47 -0700 Subject: [PATCH] Set default for readme in Manifest if it's not specified. If the readme field is not specified, assume a default of "README.md" (temporarily). Further, if the readme field is set to "false", then this defaulting behavior is suppressed. --- src/cargo/util/toml/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 246bd37f1..910fdd9c3 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1198,11 +1198,20 @@ impl TomlManifest { project.links.as_deref(), project.namespaced_features.unwrap_or(false), )?; + + let readme = match &project.readme { + None => Some(String::from("README.md")), + Some(value) => match value.as_str() { + "false" => None, + _ => Some(value.clone()) + } + }; + let metadata = ManifestMetadata { description: project.description.clone(), homepage: project.homepage.clone(), documentation: project.documentation.clone(), - readme: project.readme.clone(), + readme, authors: project.authors.clone().unwrap_or_default(), license: project.license.clone(), license_file: project.license_file.clone(),