diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/spdx-rs/src/models/snippet.rs | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/spdx-rs/src/models/snippet.rs')
-rw-r--r-- | vendor/spdx-rs/src/models/snippet.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/vendor/spdx-rs/src/models/snippet.rs b/vendor/spdx-rs/src/models/snippet.rs index 7585a0087..1de31f94b 100644 --- a/vendor/spdx-rs/src/models/snippet.rs +++ b/vendor/spdx-rs/src/models/snippet.rs @@ -20,8 +20,12 @@ pub struct Snippet { pub ranges: Vec<Range>, /// <https://spdx.github.io/spdx-spec/5-snippet-information/#55-snippet-concluded-license> - #[serde(rename = "licenseConcluded")] - pub snippet_concluded_license: SpdxExpression, + #[serde( + rename = "licenseConcluded", + skip_serializing_if = "Option::is_none", + default + )] + pub snippet_concluded_license: Option<SpdxExpression>, /// <https://spdx.github.io/spdx-spec/5-snippet-information/#56-license-information-in-snippet> #[serde( @@ -40,8 +44,12 @@ pub struct Snippet { pub snippet_comments_on_license: Option<String>, /// <https://spdx.github.io/spdx-spec/5-snippet-information/#58-snippet-copyright-text> - #[serde(rename = "copyrightText")] - pub snippet_copyright_text: String, + #[serde( + rename = "copyrightText", + skip_serializing_if = "Option::is_none", + default + )] + pub snippet_copyright_text: Option<String>, /// <https://spdx.github.io/spdx-spec/5-snippet-information/#59-snippet-comment> #[serde(rename = "comment", skip_serializing_if = "Option::is_none", default)] @@ -175,7 +183,11 @@ mod test { ) .unwrap(); assert_eq!( - spdx.snippet_information[0].snippet_concluded_license, + spdx.snippet_information[0] + .snippet_concluded_license + .as_ref() + .unwrap() + .clone(), SpdxExpression::parse("GPL-2.0-only").unwrap() ); } @@ -208,7 +220,11 @@ mod test { ) .unwrap(); assert_eq!( - spdx.snippet_information[0].snippet_copyright_text, + spdx.snippet_information[0] + .snippet_copyright_text + .as_ref() + .unwrap() + .clone(), "Copyright 2008-2010 John Smith".to_string() ); } |