-
Notifications
You must be signed in to change notification settings - Fork 14
Simplify lifetimes #9
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
base: main
Are you sure you want to change the base?
Conversation
4ee3e76
to
3247313
Compare
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.
@Twey Looks promising but it doesn't build in CI.
19134e1
to
c4d04d2
Compare
Since `&'a mut R` is `Read` (or `Write`) when `R` is `Read` (resp. `Write`), there is no need to depend on `<R: ?Sized + Read> &'a mut R` over just plain `<R: Read> R`. The caller can still instantiate `R = &'a mut R_` when a reference is desired (and indeed this is done here for e.g. `MapDeserializer`).
src/ser.rs
Outdated
// `Error::other` doesn't exist on the MSRV. | ||
#![allow(clippy::io_other_error)] | ||
// And neither does `clippy::io_other_error`. | ||
#![allow(unknown-lints)] |
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 doesn't work. Should we just bump the MSRV?
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.
Oh I think I just misnamed the lint. Fixed in a2260bf.
We could, but in order to get std::io::Error::other
we'd need to bump to 1.74, which is a pretty major bump. I'm okay with it if yous are, but it's not a decision I'd take by myself. OTOH it will steadily become harder to maintain lint compatibility between 1.56 and current Rust.
src/ser.rs
Outdated
} | ||
|
||
impl<'a, W> ser::Serializer for Serializer<'a, W> | ||
impl<'r, W> ser::Serializer for Serializer<&'r mut W> |
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.
why 'r
? The rest of the file uses 'a
consistently.
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.
Fixed in dc996e2.
This simplifies the lifetimes used in the
Serializer
andDeserializer
structs. Previous behaviour remains by instantiatingR = &mut R_
.Also fixes a few new Clippy lints.