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

Fix clippy warnings added in 1.79.0 and 1.80.0: #729

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
//! Cargo features that can be enabled with `gimli`:
//!
//! * `std`: Enabled by default. Use the `std` library. Disabling this feature
//! allows using `gimli` in embedded environments that do not have access to
//! `std`. Note that even when `std` is disabled, `gimli` still requires an
//! implementation of the `alloc` crate.
//! allows using `gimli` in embedded environments that do not have access to
//! `std`. Note that even when `std` is disabled, `gimli` still requires an
//! implementation of the `alloc` crate.
//!
//! * `read`: Enabled by default. Enables the `read` module. Use of `std` is
//! optional.
//! optional.
//!
//! * `write`: Enabled by default. Enables the `write` module. Always uses
//! the `std` library.
//! the `std` library.
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
// Selectively enable rust 2018 warnings
Expand Down
3 changes: 1 addition & 2 deletions src/read/cfi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3752,7 +3752,6 @@ mod tests {
use alloc::vec::Vec;
use core::marker::PhantomData;
use core::mem;
use core::u64;
use test_assembler::{Endian, Label, LabelMaker, LabelOrNum, Section, ToLabelOrNum};

// Ensure each test tries to read the same section kind that it wrote.
Expand Down Expand Up @@ -6850,7 +6849,7 @@ mod tests {
fn test_eh_frame_resolve_cie_offset_underflow() {
let buf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
assert_eq!(
resolve_cie_offset(&buf, ::core::usize::MAX),
resolve_cie_offset(&buf, usize::MAX),
Err(Error::OffsetOutOfBounds)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/read/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ impl<R: Reader> Dwarf<R> {
/// - an inline `DW_FORM_string` string
/// - a `DW_FORM_strp` reference to an offset into the `.debug_str` section
/// - a `DW_FORM_strp_sup` reference to an offset into a supplementary
/// object file
/// object file
/// - a `DW_FORM_line_strp` reference to an offset into the `.debug_line_str`
/// section
/// section
/// - a `DW_FORM_strx` index into the `.debug_str_offsets` entries for the unit
///
/// then return the attribute's string value. Returns an error if the attribute
Expand Down
4 changes: 2 additions & 2 deletions src/read/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ where
/// > 1. Add a signed integer to the line register.
/// >
/// > 2. Modify the operation pointer by incrementing the address and
/// > op_index registers as described below.
/// > op_index registers as described below.
/// >
/// > 3. Append a row to the matrix using the current values of the state
/// > machine registers.
/// > machine registers.
/// >
/// > 4. Set the basic_block register to “false.”
/// >
Expand Down
30 changes: 15 additions & 15 deletions src/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@
//! * Basic familiarity with DWARF is assumed.
//!
//! * The [`Dwarf`](./struct.Dwarf.html) type contains the commonly used DWARF
//! sections. It has methods that simplify access to debugging data that spans
//! multiple sections. Use of this type is optional, but recommended.
//! sections. It has methods that simplify access to debugging data that spans
//! multiple sections. Use of this type is optional, but recommended.
//!
//! * The [`DwarfPackage`](./struct.Dwarf.html) type contains the DWARF
//! package (DWP) sections. It has methods to find a DWARF object (DWO)
//! within the package.
//! package (DWP) sections. It has methods to find a DWARF object (DWO)
//! within the package.
//!
//! * Each section gets its own type. Consider these types the entry points to
//! the library:
//! the library:
//!
//! * [`DebugAbbrev`](./struct.DebugAbbrev.html): The `.debug_abbrev` section.
//!
//! * [`DebugAddr`](./struct.DebugAddr.html): The `.debug_addr` section.
//!
//! * [`DebugAranges`](./struct.DebugAranges.html): The `.debug_aranges`
//! section.
//! section.
//!
//! * [`DebugFrame`](./struct.DebugFrame.html): The `.debug_frame` section.
//!
Expand All @@ -94,10 +94,10 @@
//! * [`DebugLocLists`](./struct.DebugLocLists.html): The `.debug_loclists` section.
//!
//! * [`DebugPubNames`](./struct.DebugPubNames.html): The `.debug_pubnames`
//! section.
//! section.
//!
//! * [`DebugPubTypes`](./struct.DebugPubTypes.html): The `.debug_pubtypes`
//! section.
//! section.
//!
//! * [`DebugRanges`](./struct.DebugRanges.html): The `.debug_ranges` section.
//!
Expand All @@ -118,15 +118,15 @@
//! * [`EhFrameHdr`](./struct.EhFrameHdr.html): The `.eh_frame_hdr` section.
//!
//! * Each section type exposes methods for accessing the debugging data encoded
//! in that section. For example, the [`DebugInfo`](./struct.DebugInfo.html)
//! struct has the [`units`](./struct.DebugInfo.html#method.units) method for
//! iterating over the compilation units defined within it.
//! in that section. For example, the [`DebugInfo`](./struct.DebugInfo.html)
//! struct has the [`units`](./struct.DebugInfo.html#method.units) method for
//! iterating over the compilation units defined within it.
//!
//! * Offsets into a section are strongly typed: an offset into `.debug_info` is
//! the [`DebugInfoOffset`](./struct.DebugInfoOffset.html) type. It cannot be
//! used to index into the [`DebugLine`](./struct.DebugLine.html) type because
//! `DebugLine` represents the `.debug_line` section. There are similar types
//! for offsets relative to a compilation unit rather than a section.
//! the [`DebugInfoOffset`](./struct.DebugInfoOffset.html) type. It cannot be
//! used to index into the [`DebugLine`](./struct.DebugLine.html) type because
//! `DebugLine` represents the `.debug_line` section. There are similar types
//! for offsets relative to a compilation unit rather than a section.
//!
//! ## Using with `FallibleIterator`
//!
Expand Down
1 change: 0 additions & 1 deletion src/read/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,6 @@ mod tests {
use crate::leb128;
use crate::read::{EndianSlice, Error, Result, UnitOffset};
use crate::test_util::GimliSectionMethods;
use core::usize;
use test_assembler::{Endian, Section};

fn encoding4() -> Encoding {
Expand Down
18 changes: 7 additions & 11 deletions src/read/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4196,28 +4196,24 @@ mod tests {
)] = &[
(AttributeValue::Data1(1), Some(1), Some(1)),
(
AttributeValue::Data1(core::u8::MAX),
Some(u64::from(std::u8::MAX)),
AttributeValue::Data1(u8::MAX),
Some(u64::from(u8::MAX)),
Some(-1),
),
(AttributeValue::Data2(1), Some(1), Some(1)),
(
AttributeValue::Data2(core::u16::MAX),
Some(u64::from(std::u16::MAX)),
AttributeValue::Data2(u16::MAX),
Some(u64::from(u16::MAX)),
Some(-1),
),
(AttributeValue::Data4(1), Some(1), Some(1)),
(
AttributeValue::Data4(core::u32::MAX),
Some(u64::from(std::u32::MAX)),
AttributeValue::Data4(u32::MAX),
Some(u64::from(u32::MAX)),
Some(-1),
),
(AttributeValue::Data8(1), Some(1), Some(1)),
(
AttributeValue::Data8(core::u64::MAX),
Some(core::u64::MAX),
Some(-1),
),
(AttributeValue::Data8(u64::MAX), Some(u64::MAX), Some(-1)),
(AttributeValue::Sdata(1), Some(1), Some(1)),
(AttributeValue::Sdata(-1), None, Some(-1)),
(AttributeValue::Udata(1), Some(1), Some(1)),
Expand Down
4 changes: 2 additions & 2 deletions src/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//! in memory, and then writing it all at once. It supports two major use cases:
//!
//! * Use the [`DwarfUnit`](./struct.DwarfUnit.html) type when writing DWARF
//! for a single compilation unit.
//! for a single compilation unit.
//!
//! * Use the [`Dwarf`](./struct.Dwarf.html) type when writing DWARF for multiple
//! compilation units.
//! compilation units.
//!
//! The module also supports reading in DWARF debugging information and writing it out
//! again, possibly after modifying it. Create a [`read::Dwarf`](../read/struct.Dwarf.html)
Expand Down
1 change: 0 additions & 1 deletion src/write/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ mod tests {
use super::*;
use crate::write;
use crate::{BigEndian, LittleEndian};
use std::{i64, u64};

#[test]
fn test_writer() {
Expand Down
Loading