Skip to content

Commit 4d87bc8

Browse files
committed
Check all rustc and clippy lints in the example
1 parent d343650 commit 4d87bc8

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

example/lib.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! This crate is an example for the [soa_derive] crate functionalities. All
1+
//! This crate is an example for the [`soa_derive`] crate functionalities. All
22
//! the code is generated by a single file:
33
//!
44
//! ```no_run
@@ -22,9 +22,20 @@
2222
//! # }
2323
//! ```
2424
//!
25-
//! [soa_derive]: https://github.com/lumol-org/soa-derive/
25+
//! [`soa_derive`]: https://github.com/lumol-org/soa-derive/
2626
27-
#![deny(missing_docs)]
27+
// Deny most of allow by default lints, just to be sure we don't create warning in user code.
28+
// They are to be selectively allowed in the implementation
29+
#![deny(absolute_paths_not_starting_with_crate, anonymous_parameters, bare_trait_objects)]
30+
#![deny(box_pointers, missing_copy_implementations, missing_debug_implementations)]
31+
#![deny(missing_docs, trivial_casts, trivial_numeric_casts, unreachable_pub)]
32+
#![deny(unstable_features, unused_extern_crates, unused_import_braces, unused_labels)]
33+
#![deny(unused_lifetimes, unused_qualifications, unused_results, variant_size_differences)]
34+
35+
// Other allow by default lints that need to stay allowed
36+
#![allow(unsafe_code, single_use_lifetimes, elided_lifetimes_in_paths)]
37+
38+
#![deny(warnings)]
2839

2940
#[macro_use]
3041
extern crate soa_derive;

soa-derive-internal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "soa_derive_internal"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
authors = ["Guillaume Fraux <guillaume.fraux@chimie-paristech.fr>"]
55
license = "MIT/Apache-2.0"
66
readme = "../README.md"

soa-derive-internal/src/iter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub fn derive(input: &Input) -> TokenStream {
7979
#[allow(unused_imports)]
8080
use std::iter;
8181

82+
#[allow(missing_debug_implementations)]
8283
#visibility struct Iter<'a>(pub(super) #iter_type);
8384

8485
impl<'a> Iterator for Iter<'a> {
@@ -129,6 +130,7 @@ pub fn derive(input: &Input) -> TokenStream {
129130
}
130131
}
131132

133+
#[allow(missing_debug_implementations)]
132134
#visibility struct IterMut<'a>(pub(super) #iter_mut_type);
133135

134136
impl<'a> Iterator for IterMut<'a> {
@@ -199,7 +201,7 @@ pub fn derive(input: &Input) -> TokenStream {
199201
}
200202
}
201203

202-
impl<'a,'b> IntoIterator for &'a #slice_name<'b> {
204+
impl<'a, 'b> IntoIterator for &'a #slice_name<'b> {
203205
type Item = #ref_name<'a>;
204206
type IntoIter = #detail_mod::Iter<'a>;
205207

soa-derive-internal/src/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn derive(input: &Input) -> TokenStream {
170170
/// ; *i.e.* do a `*mut T as *const T` transformation
171171
#visibility fn as_ptr(&self) -> #ptr_name {
172172
#ptr_name {
173-
#(#fields_names_1: self.#fields_names_2 as *const _, )*
173+
#(#fields_names_1: self.#fields_names_2, )*
174174
}
175175
}
176176

@@ -302,7 +302,7 @@ pub fn derive(input: &Input) -> TokenStream {
302302
/// ; *i.e.* do a `&T as *const T` transformation
303303
#visibility fn as_ptr(&self) -> #ptr_name {
304304
#ptr_name {
305-
#(#fields_names_1: self.#fields_names_2 as *const _, )*
305+
#(#fields_names_1: self.#fields_names_2, )*
306306
}
307307
}
308308
}
@@ -316,7 +316,7 @@ pub fn derive(input: &Input) -> TokenStream {
316316
/// ; *i.e.* do a `&mut T as *const T` transformation
317317
#visibility fn as_ptr(&self) -> #ptr_name {
318318
#ptr_name {
319-
#(#fields_names_1: self.#fields_names_2 as *const _, )*
319+
#(#fields_names_1: self.#fields_names_2, )*
320320
}
321321
}
322322

@@ -327,7 +327,7 @@ pub fn derive(input: &Input) -> TokenStream {
327327
/// ; *i.e.* do a `&mut T as *mut T` transformation
328328
#visibility fn as_mut_ptr(&mut self) -> #ptr_mut_name {
329329
#ptr_mut_name {
330-
#(#fields_names_1: self.#fields_names_2 as *mut _, )*
330+
#(#fields_names_1: self.#fields_names_2, )*
331331
}
332332
}
333333
}

0 commit comments

Comments
 (0)