Merge pull request #35 from RalfJung/allow-clippy

allow clippy lint
This commit is contained in:
Ralf Jung 2019-12-07 13:21:12 +01:00 committed by GitHub
commit d3f5f23483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -5,6 +5,7 @@ cache:
matrix:
include:
- rust: 1.19.0 # Oldest supported (first version with numeric fields in struct patterns)
- rust: 1.31.0 # Oldest supported with allow(clippy)
- rust: 1.36.0 # Oldest supported with MaybeUninit
- rust: stable
- rust: beta

View File

@ -7,12 +7,14 @@ fn main() {
// Assert we haven't travelled back in time
assert!(version.major >= 1);
// Check for a minimum version
if version >= Version::from((1, 36, 0)) {
println!("cargo:rustc-cfg=memoffset_maybe_uninit");
// Check for a minimum version for a few features
if version >= Version::from((1, 31, 0)) {
println!("cargo:rustc-cfg=allow_clippy");
}
if version >= Version::from((1, 36, 0)) {
println!("cargo:rustc-cfg=maybe_uninit");
}
if version >= Version::from((1, 40, 0)) {
println!("cargo:rustc-cfg=memoffset_doctests");
println!("cargo:rustc-cfg=doctests");
}
}

View File

@ -62,10 +62,10 @@
#![cfg_attr(feature = "unstable_const", feature(ptr_offset_from))]
#[macro_use]
#[cfg(memoffset_doctests)]
#[cfg(doctests)]
#[cfg(doctest)]
extern crate doc_comment;
#[cfg(memoffset_doctests)]
#[cfg(doctests)]
#[cfg(doctest)]
doctest!("../README.md");

View File

@ -20,7 +20,7 @@
/// Macro to create a local `base_ptr` raw pointer of the given type, avoiding UB as
/// much as is possible currently.
#[cfg(memoffset_maybe_uninit)]
#[cfg(maybe_uninit)]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__let_base_ptr {
@ -34,7 +34,7 @@ macro_rules! _memoffset__let_base_ptr {
let $name = uninit.as_ptr();
};
}
#[cfg(not(memoffset_maybe_uninit))]
#[cfg(not(maybe_uninit))]
#[macro_export]
#[doc(hidden)]
macro_rules! _memoffset__let_base_ptr {
@ -53,6 +53,7 @@ macro_rules! _memoffset__field_check {
// Make sure the field actually exists. This line ensures that a
// compile-time error is generated if $field is accessed through a
// Deref impl.
#[cfg_attr(allow_clippy, allow(clippy::unneeded_field_pattern))]
let $type { $field: _, .. };
};
}