iddm / serde-aux

An auxiliary serde library providing helpful functions for serialisation and deserialisation for containers, struct fields and others.
MIT License
152 stars 26 forks source link

fix: uncomment the 'chrono' feature flag for a function #29

Closed hrkrshnn closed 1 year ago

hrkrshnn commented 1 year ago

The line 60 has use chrono::prelude, but the function doesn't have a cfg feature flag.

https://github.com/vityafx/serde-aux/blob/a5b044e1f8e61292cbdd2cdbbdb490794f5ec982/src/field_attributes.rs#L53-L60

Found the following error message in a library that uses serde-aux as a dependency.

serde-aux = { version = "4.1.1", default-features = false }
error[E0433]: failed to resolve: use of undeclared crate or module `chrono`
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:60:9
   |
60 |     use chrono::prelude::*;
   |         ^^^^^^ use of undeclared crate or module `chrono`

error[E0433]: failed to resolve: use of undeclared crate or module `chrono`
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:56:13
   |
56 | ) -> Result<chrono::DateTime<chrono::Utc>, D::Error>
   |             ^^^^^^ use of undeclared crate or module `chrono`

error[E0433]: failed to resolve: use of undeclared crate or module `chrono`
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:56:30
   |
56 | ) -> Result<chrono::DateTime<chrono::Utc>, D::Error>
   |                              ^^^^^^ use of undeclared crate or module `chrono`

error[E0433]: failed to resolve: use of undeclared type `DateTime`
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:67:8
   |
67 |     Ok(DateTime::<Utc>::from_utc(
   |        ^^^^^^^^ use of undeclared type `DateTime`

error[E0433]: failed to resolve: use of undeclared type `NaiveDateTime`
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:68:9
   |
68 |         NaiveDateTime::from_timestamp_opt(seconds, nanos)
   |         ^^^^^^^^^^^^^ use of undeclared type `NaiveDateTime`

error[E0412]: cannot find type `Utc` in this scope
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:67:19
   |
54 | pub fn deserialize_datetime_utc_from_milliseconds<'de, D>(
   |                                                         - help: you might be missing a type parameter: `, Utc`
...
67 |     Ok(DateTime::<Utc>::from_utc(
   |                   ^^^ not found in this scope

error[E0425]: cannot find value `Utc` in this scope
  --> /home/hari/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-aux-4.1.1/src/field_attributes.rs:70:9
   |
70 |         Utc,
   |         ^^^ not found in this scope

iddm commented 1 year ago

Thanks! Was in a rush today, and commented it out for some reason.

hrkrshnn commented 1 year ago

@vityafx One more fix left. Give me a second before merging.

iddm commented 1 year ago

@vityafx One more fix left. Give me a second before merging.

Thanks again. I am on a mobile right now, will publish in 20 minutes.

iddm commented 1 year ago

Perhaps, I need to add more checks in CI.

iddm commented 1 year ago

Published https://crates.io/crates/serde-aux/4.1.2 4.1.1 is yanked. Thanks again!