-
Notifications
You must be signed in to change notification settings - Fork 432
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
Fix new Clippy lints #1511
Fix new Clippy lints #1511
Conversation
@@ -123,7 +123,7 @@ pub trait CryptoBlockRng: BlockRngCore {} | |||
bound = "for<'x> R: Serialize + Deserialize<'x> + Sized, for<'x> R::Results: Serialize + Deserialize<'x>" | |||
) | |||
)] | |||
pub struct BlockRng<R: BlockRngCore + ?Sized> { | |||
pub struct BlockRng<R: BlockRngCore> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changed because of the following warning:
warning: `?Sized` bound is ignored because of a `Sized` requirement
note: ...because `Deserialize` has the bound `Sized`
AFAIK we can not use this trait with DSTs either way, since we store core by value, so the ?Sized
bound is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust does permit the last field of a struct to be unsized, but I can't see it being useful.
In this case we can drop the + Sized
bound three lines up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust does permit the last field of a struct to be unsized,
Huh, TIL. I guess it's not surprising I did not encounter it in practice since in its current form it's a virtually useless feature and even docs state that:
Yes, custom DSTs are a largely half-baked feature for now.
@@ -123,7 +123,7 @@ pub trait CryptoBlockRng: BlockRngCore {} | |||
bound = "for<'x> R: Serialize + Deserialize<'x> + Sized, for<'x> R::Results: Serialize + Deserialize<'x>" | |||
) | |||
)] | |||
pub struct BlockRng<R: BlockRngCore + ?Sized> { | |||
pub struct BlockRng<R: BlockRngCore> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust does permit the last field of a struct to be unsized, but I can't see it being useful.
In this case we can drop the + Sized
bound three lines up.
impl<'a, T, D: Distribution<T> + ?Sized> Distribution<T> for &'a D { | ||
impl<T, D: Distribution<T> + ?Sized> Distribution<T> for &D { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clippy is pedantically complaining that we're being too pedantic?
(Sorry, I'll drop the sarcasm! This is fine.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, to be fair, it's a good lint for raising awareness that such elision is allowed. As an "old-timer" who was using Rust since before 1.31, I automatically was using the "pedantic" style everywhere.
No description provided.