Skip to content

Commit

Permalink
Corrections and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Jun 17, 2024
1 parent 9f637db commit 28e8179
Show file tree
Hide file tree
Showing 39 changed files with 137 additions and 140 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ci)', 'cfg(nightly)', 'cfg(msrv)'] }
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(ci)", "cfg(msrv)", "cfg(nightly)"] }

[features]
default = ["std"]
Expand Down
3 changes: 1 addition & 2 deletions examples/deny_missing_docs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Some docs

#![allow(dead_code)]
#![deny(missing_docs)]
#![allow(dead_code)] // for illustration purposes

use derive_more::{
Add, AddAssign, Constructor, Deref, DerefMut, Display, From, FromStr, Index,
Expand Down Expand Up @@ -34,7 +34,6 @@ pub struct MyBoxedInt(Box<i32>);
pub struct MyVec(Vec<i32>);

/// Some docs
#[allow(dead_code)]
#[derive(Clone, Copy, TryInto)]
#[derive(IsVariant)]
enum MixedInts {
Expand Down
2 changes: 1 addition & 1 deletion impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ci)', 'cfg(nighthly)'] }
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(ci)", "cfg(nighthly)"] }

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion impl/src/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ impl<'a> Expansion<'a> {
let tys: Vec<_> = fields_tys.validate_type(out_ty)?.collect();

Ok(quote! {
#[automatically_derived]
#[allow(clippy::unused_unit)]
#[automatically_derived]
impl #impl_gens derive_more::core::convert::From<#r #lf #m #input_ident #ty_gens>
for ( #( #r #lf #m #tys ),* ) #where_clause
{
Expand Down
3 changes: 1 addition & 2 deletions impl/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![cfg_attr(
not(all(feature = "add", feature = "mul")),
allow(dead_code),
allow(unused_mut)
allow(dead_code, unused_mut)
)]

use proc_macro2::TokenStream;
Expand Down
2 changes: 1 addition & 1 deletion tests/add.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use derive_more::Add;

Expand Down
2 changes: 1 addition & 1 deletion tests/add_assign.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use derive_more::AddAssign;

Expand Down
3 changes: 2 additions & 1 deletion tests/as_mut.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, clippy::unnecessary_mut_passed)]
#![allow(clippy::unnecessary_mut_passed)] // testing correct signatures rather than actual code
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/as_ref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/boats_display_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn tuple_struct() {
assert_eq!(s, "Error code: 2");
}

#[allow(clippy::enum_variant_names)]
#[allow(clippy::enum_variant_names)] // because of the original source
#[derive(Display)]
enum EnumError {
#[display("Error code: {}", code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/constructor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use derive_more::Constructor;

Expand Down
2 changes: 1 addition & 1 deletion tests/debug.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/deref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, unused_imports)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/deref_mut.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, unused_imports)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/display.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, unused_imports)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
3 changes: 2 additions & 1 deletion tests/error/derives_for_enums_with_source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use super::*;

derive_display!(TestErr);
Expand Down
3 changes: 2 additions & 1 deletion tests/error/derives_for_generic_enums_with_source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use super::*;

derive_display!(TestErr, T, E);
Expand Down
3 changes: 2 additions & 1 deletion tests/error/derives_for_generic_structs_with_source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use super::*;

#[test]
Expand Down
3 changes: 2 additions & 1 deletion tests/error/derives_for_structs_with_source.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

use super::*;

#[test]
Expand Down
7 changes: 3 additions & 4 deletions tests/error/nightly/derives_for_enums_with_backtrace.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(dead_code)]
// Allow redundant closures in tests, because we use them to create backtraces with different
// addresses.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)]
// For creating backtraces with different addresses in tests.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)] // for testing
#![allow(dead_code)] // some code is tested for type checking only

use core::error::{request_ref, request_value};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(dead_code)]
// Allow redundant closures in tests, because we use them to create backtraces with different
// addresses.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)]
// For creating backtraces with different addresses in tests.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)] // for testing
#![allow(dead_code)] // some code is tested for type checking only

use core::error::{request_ref, request_value};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(dead_code)]
// Allow redundant closures in tests, because we use them to create backtraces with different
// addresses.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)]
// For creating backtraces with different addresses in tests.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)] // for testing
#![allow(dead_code)] // some code is tested for type checking only

use core::error::{request_ref, request_value};

Expand Down
7 changes: 3 additions & 4 deletions tests/error/nightly/derives_for_structs_with_backtrace.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(dead_code)]
// Allow redundant closures in tests, because we use them to create backtraces with different
// addresses.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)]
// For creating backtraces with different addresses in tests.
#![allow(clippy::redundant_closure, clippy::redundant_closure_call)] // for testing
#![allow(dead_code)] // some code is tested for type checking only

use core::error::{request_ref, request_value};

Expand Down
2 changes: 1 addition & 1 deletion tests/from.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/from_str.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/generics.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, non_camel_case_types)]
#![allow(dead_code)] // some code is tested for type checking only

use derive_more::{
Add, AddAssign, Constructor, Deref, DerefMut, Display, Error, From, FromStr, Index,
Expand Down
2 changes: 1 addition & 1 deletion tests/index.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(dead_code, unused_imports)]
#![allow(dead_code)] // some code is tested for type checking only

#[cfg(not(feature = "std"))]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion tests/index_mut.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code, unused_imports)]
#![allow(dead_code)] // some code is tested for type checking only

use derive_more::IndexMut;

Expand Down
Loading

0 comments on commit 28e8179

Please sign in to comment.