Skip to content

Commit b921aa3

Browse files
authored
Fix 'hidden lifetime parameters in types are deprecated' (gimli-rs#713)
1 parent c49f64d commit b921aa3

File tree

19 files changed

+104
-80
lines changed

19 files changed

+104
-80
lines changed

crates/examples/src/bin/dwarfdump.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub enum Error {
2828

2929
impl fmt::Display for Error {
3030
#[inline]
31-
fn fmt(&self, f: &mut fmt::Formatter) -> ::std::result::Result<(), fmt::Error> {
31+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> ::std::result::Result<(), fmt::Error> {
3232
Debug::fmt(self, f)
3333
}
3434
}

src/constants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use core::{fmt, ops};
5151
// }
5252
//
5353
// impl fmt::Display for DwFoo {
54-
// fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
54+
// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
5555
// ...
5656
// }
5757
// }
@@ -83,7 +83,7 @@ macro_rules! dw {
8383
}
8484

8585
impl fmt::Display for $struct_name {
86-
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
86+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
8787
if let Some(s) = self.static_string() {
8888
f.pad(s)
8989
} else {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#![warn(bare_trait_objects)]
2525
#![warn(unused_extern_crates)]
2626
#![warn(ellipsis_inclusive_range_patterns)]
27-
//#![warn(elided_lifetimes_in_paths)]
27+
#![warn(elided_lifetimes_in_paths)]
2828
#![warn(explicit_outlives_requirements)]
2929
// Style.
3030
#![allow(clippy::bool_to_int_with_if)]

src/read/cfi.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<R: Reader> ParsedEhFrameHdr<R> {
207207
}
208208

209209
/// Retrieves the CFI binary search table, if there is one.
210-
pub fn table(&self) -> Option<EhHdrTable<R>> {
210+
pub fn table(&self) -> Option<EhHdrTable<'_, R>> {
211211
// There are two big edge cases here:
212212
// * You search the table for an invalid address. As this is just a binary
213213
// search table, we always have to return a valid result for that (unless
@@ -1245,7 +1245,7 @@ struct AugmentationData {
12451245
impl AugmentationData {
12461246
fn parse<R: Reader>(
12471247
augmentation: &Augmentation,
1248-
encoding_parameters: &PointerEncodingParameters<R>,
1248+
encoding_parameters: &PointerEncodingParameters<'_, R>,
12491249
input: &mut R,
12501250
) -> Result<AugmentationData> {
12511251
// In theory, we should be iterating over the original augmentation
@@ -1712,7 +1712,7 @@ impl<R: Reader> FrameDescriptionEntry<R> {
17121712
fn parse_addresses(
17131713
input: &mut R,
17141714
cie: &CommonInformationEntry<R>,
1715-
parameters: &PointerEncodingParameters<R>,
1715+
parameters: &PointerEncodingParameters<'_, R>,
17161716
) -> Result<(u64, u64)> {
17171717
let encoding = cie.augmentation().and_then(|a| a.fde_address_encoding);
17181718
if let Some(encoding) = encoding {
@@ -1990,7 +1990,7 @@ pub struct UnwindContext<T: ReaderOffset, A: UnwindContextStorage<T> = StoreOnHe
19901990
}
19911991

19921992
impl<T: ReaderOffset, S: UnwindContextStorage<T>> Debug for UnwindContext<T, S> {
1993-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1993+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19941994
f.debug_struct("UnwindContext")
19951995
.field("stack", &self.stack)
19961996
.field("initial_rule", &self.initial_rule)
@@ -2524,7 +2524,7 @@ struct RegisterRuleMap<T: ReaderOffset, S: UnwindContextStorage<T> = StoreOnHeap
25242524
}
25252525

25262526
impl<T: ReaderOffset, S: UnwindContextStorage<T>> Debug for RegisterRuleMap<T, S> {
2527-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2527+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25282528
f.debug_struct("RegisterRuleMap")
25292529
.field("rules", &self.rules)
25302530
.finish()
@@ -2594,7 +2594,7 @@ impl<T: ReaderOffset, S: UnwindContextStorage<T>> RegisterRuleMap<T, S> {
25942594
.map_err(|_| Error::TooManyRegisterRules)
25952595
}
25962596

2597-
fn iter(&self) -> RegisterRuleIter<T> {
2597+
fn iter(&self) -> RegisterRuleIter<'_, T> {
25982598
RegisterRuleIter(self.rules.iter())
25992599
}
26002600
}
@@ -2671,7 +2671,7 @@ pub struct UnwindTableRow<T: ReaderOffset, S: UnwindContextStorage<T> = StoreOnH
26712671
}
26722672

26732673
impl<T: ReaderOffset, S: UnwindContextStorage<T>> Debug for UnwindTableRow<T, S> {
2674-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2674+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26752675
f.debug_struct("UnwindTableRow")
26762676
.field("start_address", &self.start_address)
26772677
.field("end_address", &self.end_address)
@@ -2812,7 +2812,7 @@ impl<T: ReaderOffset, S: UnwindContextStorage<T>> UnwindTableRow<T, S> {
28122812
/// }
28132813
/// # }
28142814
/// ```
2815-
pub fn registers(&self) -> RegisterRuleIter<T> {
2815+
pub fn registers(&self) -> RegisterRuleIter<'_, T> {
28162816
self.registers.iter()
28172817
}
28182818
}
@@ -3209,7 +3209,7 @@ impl<T: ReaderOffset> CallFrameInstruction<T> {
32093209
fn parse<R: Reader<Offset = T>>(
32103210
input: &mut R,
32113211
address_encoding: Option<DwEhPe>,
3212-
parameters: &PointerEncodingParameters<R>,
3212+
parameters: &PointerEncodingParameters<'_, R>,
32133213
vendor: Vendor,
32143214
) -> Result<CallFrameInstruction<T>> {
32153215
let instruction = input.read_u8()?;
@@ -3557,7 +3557,7 @@ struct PointerEncodingParameters<'a, R: Reader> {
35573557

35583558
fn parse_encoded_pointer<R: Reader>(
35593559
encoding: constants::DwEhPe,
3560-
parameters: &PointerEncodingParameters<R>,
3560+
parameters: &PointerEncodingParameters<'_, R>,
35613561
input: &mut R,
35623562
) -> Result<Pointer> {
35633563
// TODO: check this once only in parse_pointer_encoding

src/read/dwarf.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl<R: Reader> Dwarf<R> {
540540
pub fn die_ranges(
541541
&self,
542542
unit: &Unit<R>,
543-
entry: &DebuggingInformationEntry<R>,
543+
entry: &DebuggingInformationEntry<'_, '_, R>,
544544
) -> Result<RangeIter<R>> {
545545
let mut low_pc = None;
546546
let mut high_pc = None;
@@ -992,7 +992,7 @@ impl<R: Reader> DwarfPackage<R> {
992992
/// This function should only be needed by low level parsers.
993993
pub fn sections(
994994
&self,
995-
sections: UnitIndexSectionIterator<R>,
995+
sections: UnitIndexSectionIterator<'_, R>,
996996
parent: &Dwarf<R>,
997997
) -> Result<Dwarf<R>> {
998998
let mut abbrev_offset = 0;
@@ -1276,33 +1276,45 @@ impl<R: Reader> Unit<R> {
12761276
}
12771277

12781278
/// Read the `DebuggingInformationEntry` at the given offset.
1279-
pub fn entry(&self, offset: UnitOffset<R::Offset>) -> Result<DebuggingInformationEntry<R>> {
1279+
pub fn entry(
1280+
&self,
1281+
offset: UnitOffset<R::Offset>,
1282+
) -> Result<DebuggingInformationEntry<'_, '_, R>> {
12801283
self.header.entry(&self.abbreviations, offset)
12811284
}
12821285

12831286
/// Navigate this unit's `DebuggingInformationEntry`s.
12841287
#[inline]
1285-
pub fn entries(&self) -> EntriesCursor<R> {
1288+
pub fn entries(&self) -> EntriesCursor<'_, '_, R> {
12861289
self.header.entries(&self.abbreviations)
12871290
}
12881291

12891292
/// Navigate this unit's `DebuggingInformationEntry`s
12901293
/// starting at the given offset.
12911294
#[inline]
1292-
pub fn entries_at_offset(&self, offset: UnitOffset<R::Offset>) -> Result<EntriesCursor<R>> {
1295+
pub fn entries_at_offset(
1296+
&self,
1297+
offset: UnitOffset<R::Offset>,
1298+
) -> Result<EntriesCursor<'_, '_, R>> {
12931299
self.header.entries_at_offset(&self.abbreviations, offset)
12941300
}
12951301

12961302
/// Navigate this unit's `DebuggingInformationEntry`s as a tree
12971303
/// starting at the given offset.
12981304
#[inline]
1299-
pub fn entries_tree(&self, offset: Option<UnitOffset<R::Offset>>) -> Result<EntriesTree<R>> {
1305+
pub fn entries_tree(
1306+
&self,
1307+
offset: Option<UnitOffset<R::Offset>>,
1308+
) -> Result<EntriesTree<'_, '_, R>> {
13001309
self.header.entries_tree(&self.abbreviations, offset)
13011310
}
13021311

13031312
/// Read the raw data that defines the Debugging Information Entries.
13041313
#[inline]
1305-
pub fn entries_raw(&self, offset: Option<UnitOffset<R::Offset>>) -> Result<EntriesRaw<R>> {
1314+
pub fn entries_raw(
1315+
&self,
1316+
offset: Option<UnitOffset<R::Offset>>,
1317+
) -> Result<EntriesRaw<'_, '_, R>> {
13061318
self.header.entries_raw(&self.abbreviations, offset)
13071319
}
13081320

@@ -1466,7 +1478,7 @@ impl<'a, R: Reader> UnitRef<'a, R> {
14661478
/// Return an iterator for the address ranges of a `DebuggingInformationEntry`.
14671479
///
14681480
/// This uses `DW_AT_low_pc`, `DW_AT_high_pc` and `DW_AT_ranges`.
1469-
pub fn die_ranges(&self, entry: &DebuggingInformationEntry<R>) -> Result<RangeIter<R>> {
1481+
pub fn die_ranges(&self, entry: &DebuggingInformationEntry<'_, '_, R>) -> Result<RangeIter<R>> {
14701482
self.dwarf.die_ranges(self.unit, entry)
14711483
}
14721484

@@ -1634,8 +1646,8 @@ mod tests {
16341646
#[test]
16351647
fn test_send() {
16361648
fn assert_is_send<T: Send>() {}
1637-
assert_is_send::<Dwarf<EndianSlice<LittleEndian>>>();
1638-
assert_is_send::<Unit<EndianSlice<LittleEndian>>>();
1649+
assert_is_send::<Dwarf<EndianSlice<'_, LittleEndian>>>();
1650+
assert_is_send::<Unit<EndianSlice<'_, LittleEndian>>>();
16391651
}
16401652

16411653
#[test]

src/read/endian_reader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,20 +448,20 @@ where
448448
}
449449

450450
#[inline]
451-
fn to_slice(&self) -> Result<Cow<[u8]>> {
451+
fn to_slice(&self) -> Result<Cow<'_, [u8]>> {
452452
Ok(self.bytes().into())
453453
}
454454

455455
#[inline]
456-
fn to_string(&self) -> Result<Cow<str>> {
456+
fn to_string(&self) -> Result<Cow<'_, str>> {
457457
match str::from_utf8(self.bytes()) {
458458
Ok(s) => Ok(s.into()),
459459
_ => Err(Error::BadUtf8),
460460
}
461461
}
462462

463463
#[inline]
464-
fn to_string_lossy(&self) -> Result<Cow<str>> {
464+
fn to_string_lossy(&self) -> Result<Cow<'_, str>> {
465465
Ok(String::from_utf8_lossy(self.bytes()))
466466
}
467467

src/read/endian_slice.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,13 @@ where
304304

305305
#[cfg(feature = "read")]
306306
#[inline]
307-
fn to_slice(&self) -> Result<Cow<[u8]>> {
307+
fn to_slice(&self) -> Result<Cow<'_, [u8]>> {
308308
Ok(self.slice.into())
309309
}
310310

311311
#[cfg(feature = "read")]
312312
#[inline]
313-
fn to_string(&self) -> Result<Cow<str>> {
313+
fn to_string(&self) -> Result<Cow<'_, str>> {
314314
match str::from_utf8(self.slice) {
315315
Ok(s) => Ok(s.into()),
316316
_ => Err(Error::BadUtf8),
@@ -319,7 +319,7 @@ where
319319

320320
#[cfg(feature = "read")]
321321
#[inline]
322-
fn to_string_lossy(&self) -> Result<Cow<str>> {
322+
fn to_string_lossy(&self) -> Result<Cow<'_, str>> {
323323
Ok(String::from_utf8_lossy(self.slice))
324324
}
325325

src/read/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<R: Reader> UnitIndex<R> {
256256
}
257257

258258
/// Return the section offsets and sizes for the given row index.
259-
pub fn sections(&self, mut row: u32) -> Result<UnitIndexSectionIterator<R>> {
259+
pub fn sections(&self, mut row: u32) -> Result<UnitIndexSectionIterator<'_, R>> {
260260
if row == 0 {
261261
return Err(Error::InvalidIndexRow);
262262
}

src/read/line.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ where
521521
R: Reader<Offset = Offset>,
522522
Offset: ReaderOffset,
523523
{
524-
fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
524+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> result::Result<(), fmt::Error> {
525525
match *self {
526526
LineInstruction::Special(opcode) => write!(f, "Special opcode {}", opcode),
527527
LineInstruction::Copy => write!(f, "{}", constants::DW_LNS_copy),
@@ -2124,8 +2124,8 @@ mod tests {
21242124
const STANDARD_OPCODE_LENGTHS: &[u8] = &[0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1];
21252125

21262126
fn make_test_header(
2127-
buf: EndianSlice<LittleEndian>,
2128-
) -> LineProgramHeader<EndianSlice<LittleEndian>> {
2127+
buf: EndianSlice<'_, LittleEndian>,
2128+
) -> LineProgramHeader<EndianSlice<'_, LittleEndian>> {
21292129
let encoding = Encoding {
21302130
format: Format::Dwarf32,
21312131
version: 4,
@@ -2170,8 +2170,8 @@ mod tests {
21702170
}
21712171

21722172
fn make_test_program(
2173-
buf: EndianSlice<LittleEndian>,
2174-
) -> IncompleteLineProgram<EndianSlice<LittleEndian>> {
2173+
buf: EndianSlice<'_, LittleEndian>,
2174+
) -> IncompleteLineProgram<EndianSlice<'_, LittleEndian>> {
21752175
IncompleteLineProgram {
21762176
header: make_test_header(buf),
21772177
}
@@ -2198,7 +2198,7 @@ mod tests {
21982198
fn test<Operands>(
21992199
raw: constants::DwLns,
22002200
operands: Operands,
2201-
expected: LineInstruction<EndianSlice<LittleEndian>>,
2201+
expected: LineInstruction<EndianSlice<'_, LittleEndian>>,
22022202
) where
22032203
Operands: AsRef<[u8]>,
22042204
{
@@ -2341,7 +2341,7 @@ mod tests {
23412341
fn test<Operands>(
23422342
raw: constants::DwLne,
23432343
operands: Operands,
2344-
expected: LineInstruction<EndianSlice<LittleEndian>>,
2344+
expected: LineInstruction<EndianSlice<'_, LittleEndian>>,
23452345
) where
23462346
Operands: AsRef<[u8]>,
23472347
{

src/read/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ pub enum Error {
442442

443443
impl fmt::Display for Error {
444444
#[inline]
445-
fn fmt(&self, f: &mut fmt::Formatter) -> ::core::result::Result<(), fmt::Error> {
445+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> ::core::result::Result<(), fmt::Error> {
446446
write!(f, "{}", self.description())
447447
}
448448
}

0 commit comments

Comments
 (0)