Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing deprecation message for time::Instant #677

Closed
johnbatty opened this issue Apr 15, 2024 · 3 comments
Closed

Confusing deprecation message for time::Instant #677

johnbatty opened this issue Apr 15, 2024 · 3 comments
Labels
C-enhancement Category: an enhancement with existing code

Comments

@johnbatty
Copy link

time::Instant was deprecated in 0.3.35:
#650

The deprecation error message displayed by clippy is:

error: use of deprecated struct `time::Instant`: import `time::ext::InstantExt` instead

This is confusing advice, as the primary fix is to use std::time::Instant rather than time::Instant. It took me a while to figure this out.
There are some additional extension methods defined in time::ext::InstantExt, but these won't be required by most users.

I suggest that the error is changed to:

error: use of deprecated struct `time::Instant`: import `std::time::Instant` instead
@jhpratt
Copy link
Member

jhpratt commented Apr 15, 2024

I'm open to changing the deprecation message, but my initial thought is why you're using time::Instant instead of std::time::Instant if you're not using any of the additional interoperability time provides? It is otherwise a trivial wrapper struct.

@johnbatty
Copy link
Author

It wasn't a conscious decision to pick time::Instant over std::time::Instant. I just happened to be already using the time crate (for formatting) and saw that it included Instant. So I'm happy to switch (and already have).

@jhpratt
Copy link
Member

jhpratt commented Apr 18, 2024

The deprecation message has been changed on main.

@jhpratt jhpratt closed this as completed Apr 18, 2024
@jhpratt jhpratt added the C-enhancement Category: an enhancement with existing code label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: an enhancement with existing code
Projects
None yet
Development

No branches or pull requests

2 participants