From 73cfa746505dba25e1623fcf5f845534b09a7b89 Mon Sep 17 00:00:00 2001 From: Matt Vertescher Date: Wed, 13 Nov 2019 03:32:35 -0500 Subject: [PATCH] Deny a subset of warnings instead of all in the generated lib.rs This change decreases the chance of Rust build failures when SVD files have strange formatting for types. The changelog has also been updated. --- CHANGELOG.md | 1 + src/generate/device.rs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e35f45..cd292790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Enum items now associated with values (C-style), enums annotated with `repr(fty)` - Bump `svd-parser` dependency (0.8.1) +- Switched from denying all warnings to only a subset. ## [v0.16.1] - 2019-08-17 diff --git a/src/generate/device.rs b/src/generate/device.rs index 8c826467..32c14c6b 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -45,9 +45,29 @@ pub fn render( out.push(quote! { #![doc = #doc] + // Deny a subset of warnings + #![deny(const_err)] + #![deny(dead_code)] + #![deny(improper_ctypes)] + #![deny(legacy_directory_ownership)] #![deny(missing_docs)] - #![deny(warnings)] + #![deny(no_mangle_generic_items)] + #![deny(non_shorthand_field_patterns)] + #![deny(overflowing_literals)] + #![deny(path_statements)] + #![deny(patterns_in_fns_without_body)] + #![deny(plugin_as_library)] + #![deny(private_in_public)] + #![deny(safe_extern_statics)] + #![deny(unconditional_recursion)] + #![deny(unions_with_drop_fields)] + #![deny(unused_allocation)] + #![deny(unused_comparisons)] + #![deny(unused_parens)] + #![deny(while_true)] + // Explicitly allow a few warnings that may be verbose #![allow(non_camel_case_types)] + #![allow(non_snake_case)] #![no_std] });