Skip to content

Commit b23390b

Browse files
committed
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.
1 parent 13bded9 commit b23390b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,11 +1198,20 @@ impl TomlManifest {
11981198
project.links.as_deref(),
11991199
project.namespaced_features.unwrap_or(false),
12001200
)?;
1201+
1202+
let readme = match &project.readme {
1203+
None => Some(String::from("README.md")),
1204+
Some(value) => match value.as_str() {
1205+
"false" => None,
1206+
_ => Some(value.clone())
1207+
}
1208+
};
1209+
12011210
let metadata = ManifestMetadata {
12021211
description: project.description.clone(),
12031212
homepage: project.homepage.clone(),
12041213
documentation: project.documentation.clone(),
1205-
readme: project.readme.clone(),
1214+
readme,
12061215
authors: project.authors.clone().unwrap_or_default(),
12071216
license: project.license.clone(),
12081217
license_file: project.license_file.clone(),

0 commit comments

Comments
 (0)