From b2e8b45100083197622154a7541c855ae9f04861 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Tue, 14 Nov 2017 16:14:28 +0100 Subject: [PATCH] Avoid copyright notice for MPL2-licensed dependencies The license does not include a copyright notice --- libs/codegen/src/licenses.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/codegen/src/licenses.rs b/libs/codegen/src/licenses.rs index 88ddfea..942015c 100644 --- a/libs/codegen/src/licenses.rs +++ b/libs/codegen/src/licenses.rs @@ -18,6 +18,16 @@ pub enum LicenseId { Ofl11, } +impl LicenseId { + fn include_notice(&self) -> bool { + use self::LicenseId::*; + match self { + &Mpl2 => false, + _ => true, + } + } +} + impl quote::ToTokens for LicenseId { fn to_tokens(&self, tokens: &mut quote::Tokens) { use self::LicenseId::*; @@ -54,6 +64,11 @@ impl quote::ToTokens for LicenseReport { &None => quote! { None }, }; + let copyright = match license.include_notice() { + true => copyright, + false => "", + }; + tokens.append(quote! { LicenseInfo { name: #name,