nrc / derive-new

derive simple constructor functions for Rust structs
MIT License
525 stars 35 forks source link

Ignore unrelated field attributes #36

Closed siler closed 6 years ago

siler commented 6 years ago

Currently all attributes on fields are parsed by derive-new. This change updates the attribute parsing logic to ignore any attribute that aren't specifically for derive-new. For example, previously:

#[derive(new)]
pub struct All {
    #[allow(missing_docs)]
    pub x: i32
}

Would result in the following error:

error: proc-macro derive panicked --> tests\test.rs:289:10 289 #[derive(new, PartialEq, Debug)] ^^^
= help: message: Invalid #[new] attribute: #[new(missing_docs)]

The revision of compiletest was updated to allow all tests to build on stable. It might be a good idea to configure the CI to use the minimum supported version of Rust to execute tests.

Additionally, I was having issues building tests due to the workspace configuration and syn::Generics. I didn't look into it much, but removed the workspace configuration so it wouldn't affect others.

siler commented 6 years ago

Well that is amusing.

nrc commented 6 years ago

Thanks!

nrc commented 6 years ago

Published 0.5.4