From 66162e9896bfa9b38bfc65db62da8615135e9a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 2 Dec 2022 13:46:35 +0100 Subject: [PATCH] Give more license to the license field (#572) --- flake-info/src/data/export.rs | 13 ++++++++----- flake-info/src/data/import.rs | 7 ++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flake-info/src/data/export.rs b/flake-info/src/data/export.rs index d0e3fda..f953814 100644 --- a/flake-info/src/data/export.rs +++ b/flake-info/src/data/export.rs @@ -30,16 +30,19 @@ impl From for License { match license { import::License::None { .. } => License { url: None, - fullName: "No License Specified".to_string(), + fullName: "no license specified".to_string(), }, import::License::Simple { license } => License { url: None, fullName: license, }, - import::License::Full { fullName, url, .. } => License { url, fullName }, - import::License::Url { url } => License { - url: Some(url), - fullName: "No Name".into(), + import::License::Full { + fullName, + shortName, + url, + } => License { + url, + fullName: fullName.unwrap_or(shortName.unwrap_or("custom".into())), }, } } diff --git a/flake-info/src/data/import.rs b/flake-info/src/data/import.rs index 43cc91c..4e11c0a 100644 --- a/flake-info/src/data/import.rs +++ b/flake-info/src/data/import.rs @@ -264,13 +264,10 @@ pub enum License { }, #[allow(non_snake_case)] Full { - fullName: String, - // shortName: String, + fullName: Option, + shortName: Option, url: Option, }, - Url { - url: String, - }, } impl Default for License {