refactor: enable elided_lifetimes_in_paths lint (#203)

Hiding the lifetimes is making the code less obvious.

That’s not a problem for types that I know about intimately such as
`ReadCursor` or `WriteCursor`, but I actually found myself surprised
more than once when reading code I didn’t authored, discovering  later
there was in fact a hidden lifetime parameter.
I expect this problem to be worse for someone not familiar with
our codebase.

I understand this lint is "allow" by default because in some cases
it leads to writing unergonomic ugly code when a type has many generic
lifetimes parameters:

```
TyCtxt<'_, '_, '_>
```

However we _never_ work with more than one generic lifetime parameter in
IronRDP codebase, so it seems to me that the tradeoff towards clarity is
worth it, in our case.
This commit is contained in:
Benoît Cortier 2023-10-04 12:14:36 -04:00 committed by GitHub
parent c670ab4331
commit 3d98cd1d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 343 additions and 137 deletions

View file

@ -20,7 +20,7 @@ pub fn pdu_decode(data: &[u8]) {
let _ = decode::<ConnectionRequest>(data);
let _ = decode::<ConnectionConfirm>(data);
let _ = decode::<McsMessage>(data);
let _ = decode::<McsMessage<'_>>(data);
let _ = ConnectInitial::from_buffer(data);
let _ = ConnectResponse::from_buffer(data);
let _ = ClientInfoPdu::from_buffer(data);
@ -45,13 +45,13 @@ pub fn pdu_decode(data: &[u8]) {
let _ = vc::ChannelPduHeader::from_buffer(data);
let _ = decode::<fast_path::FastPathHeader>(data);
let _ = decode::<fast_path::FastPathUpdatePdu>(data);
let _ = decode::<fast_path::FastPathUpdatePdu<'_>>(data);
let _ = fast_path::FastPathUpdate::decode_with_code(data, fast_path::UpdateCode::SurfaceCommands);
let _ = decode::<surface_commands::SurfaceCommand>(data);
let _ = decode::<surface_commands::SurfaceBitsPdu>(data);
let _ = decode::<surface_commands::SurfaceCommand<'_>>(data);
let _ = decode::<surface_commands::SurfaceBitsPdu<'_>>(data);
let _ = decode::<surface_commands::FrameMarkerPdu>(data);
let _ = decode::<surface_commands::ExtendedBitmapDataPdu>(data);
let _ = decode::<surface_commands::ExtendedBitmapDataPdu<'_>>(data);
let _ = decode::<surface_commands::BitmapDataHeader>(data);
let _ = codecs::rfx::Headers::from_buffer(data);
@ -72,14 +72,14 @@ pub fn pdu_decode(data: &[u8]) {
let _ = input::InputEventPdu::from_buffer(data);
let _ = input::InputEvent::from_buffer(data);
let _ = decode::<bitmap::rdp6::BitmapStream>(data);
let _ = decode::<bitmap::rdp6::BitmapStream<'_>>(data);
let _ = decode::<ironrdp_cliprdr::pdu::ClipboardPdu>(data);
let _ = decode::<ironrdp_cliprdr::pdu::ClipboardPdu<'_>>(data);
let _ = decode::<ironrdp_rdpdr::pdu::RdpdrPdu>(data);
}
pub fn rle_decompress_bitmap(input: BitmapInput) {
pub fn rle_decompress_bitmap(input: BitmapInput<'_>) {
let mut out = Vec::new();
let _ = ironrdp_graphics::rle::decompress_24_bpp(input.src, &mut out, input.width, input.height);
@ -88,7 +88,7 @@ pub fn rle_decompress_bitmap(input: BitmapInput) {
let _ = ironrdp_graphics::rle::decompress_8_bpp(input.src, &mut out, input.width, input.height);
}
pub fn rdp6_encode_bitmap_stream(input: &BitmapInput) {
pub fn rdp6_encode_bitmap_stream(input: &BitmapInput<'_>) {
use ironrdp_graphics::rdp6::{BitmapStreamEncoder, RgbAChannels, RgbChannels};
let mut out = vec![0; input.src.len() * 2];
@ -106,7 +106,7 @@ pub fn rdp6_encode_bitmap_stream(input: &BitmapInput) {
);
}
pub fn rdp6_decode_bitmap_stream_to_rgb24(input: &BitmapInput) {
pub fn rdp6_decode_bitmap_stream_to_rgb24(input: &BitmapInput<'_>) {
use ironrdp_graphics::rdp6::BitmapStreamDecoder;
let mut out = Vec::new();