Skip to content

Commit 46949a8

Browse files
authored
chore: Fix various warnings from RustRover (#1682)
1 parent 4e1c5cb commit 46949a8

17 files changed

Lines changed: 46 additions & 52 deletions

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libwild/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ impl ArgumentParser {
11011101
// TODO: This is ad-hoc
11021102
help.push_str(&format!(
11031103
" {:<31} Read options from a file\n",
1104-
format!("@<VALUE>"),
1104+
"@<VALUE>",
11051105
));
11061106

11071107
let mut help_to_options: HashMap<&str, Vec<String>> = HashMap::new();

libwild/src/elf.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl platform::Platform for Elf {
354354
*memory_offsets.get(part_id::EH_FRAME)
355355
}
356356

357-
fn finalise_find_required_sections<'data>(groups: &[layout::GroupState<'data, Elf>]) {
357+
fn finalise_find_required_sections(groups: &[layout::GroupState<Elf>]) {
358358
tracing::debug!(target: "metrics", total = groups
359359
.iter()
360360
.map(|g| g.common.format_specific.exception_frame_count)
@@ -580,8 +580,8 @@ impl platform::Platform for Elf {
580580
&[STACK_SEGMENT_DEF]
581581
}
582582

583-
fn create_linker_defined_symbols<'data>(
584-
symbols: &mut crate::parsing::InternalSymbolsBuilder<'data>,
583+
fn create_linker_defined_symbols(
584+
symbols: &mut crate::parsing::InternalSymbolsBuilder,
585585
output_kind: OutputKind,
586586
) {
587587
// The undefined symbol must always be symbol 0.
@@ -1782,7 +1782,7 @@ fn allocate_sysv_hash(
17821782
return Ok(());
17831783
}
17841784

1785-
let bucket_count = ((num_defs / 2).max(1)).next_power_of_two() as u32;
1785+
let bucket_count = (num_defs / 2).max(1).next_power_of_two() as u32;
17861786
// Whereas `num_defs` above is the number of definitions, this is the number of dynamic
17871787
// symbols, which also includes undefined dynamic symbols.
17881788
let num_dynsym = *current_sizes.get(part_id::DYNSYM) / SYMTAB_ENTRY_SIZE;
@@ -2943,7 +2943,7 @@ pub(crate) struct NonAddressableIndexes {
29432943
}
29442944

29452945
impl platform::NonAddressableIndexes for NonAddressableIndexes {
2946-
fn new<'data, P: Platform>(symbol_db: &crate::symbol_db::SymbolDb<'data, P>) -> Self {
2946+
fn new<P: Platform>(symbol_db: &crate::symbol_db::SymbolDb<P>) -> Self {
29472947
Self {
29482948
// Allocate version indexes starting from after the local and global indexes and any
29492949
// versions defined by a version script.

libwild/src/elf_aarch64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl crate::platform::Arch for ElfAArch64 {
9999
false
100100
}
101101

102-
fn tp_offset_start<'data>(layout: &Layout<'data, Elf>) -> u64 {
102+
fn tp_offset_start(layout: &Layout<Elf>) -> u64 {
103103
layout.tls_start_address_aarch64()
104104
}
105105

@@ -278,8 +278,8 @@ impl crate::platform::Arch for ElfAArch64 {
278278
None
279279
}
280280

281-
fn is_symbol_variant_pcs<'data>(
282-
object: &<Self::Platform as Platform>::File<'data>,
281+
fn is_symbol_variant_pcs(
282+
object: &<Self::Platform as Platform>::File<'_>,
283283
symbol_index: object::SymbolIndex,
284284
) -> bool {
285285
object

libwild/src/elf_loongarch64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl crate::platform::Arch for ElfLoongArch64 {
8181
true
8282
}
8383

84-
fn tp_offset_start<'data>(layout: &crate::layout::Layout<'data, Elf>) -> u64 {
84+
fn tp_offset_start(layout: &crate::layout::Layout<Elf>) -> u64 {
8585
layout.tls_start_address()
8686
}
8787

libwild/src/elf_riscv64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl crate::platform::Arch for ElfRiscV64 {
9999
true
100100
}
101101

102-
fn tp_offset_start<'data>(layout: &crate::layout::Layout<'data, Elf>) -> u64 {
102+
fn tp_offset_start(layout: &crate::layout::Layout<Elf>) -> u64 {
103103
layout.tls_start_address()
104104
}
105105

@@ -155,8 +155,8 @@ impl crate::platform::Arch for ElfRiscV64 {
155155
]
156156
}
157157

158-
fn is_symbol_variant_pcs<'data>(
159-
object: &<Self::Platform as Platform>::File<'data>,
158+
fn is_symbol_variant_pcs(
159+
object: &<Self::Platform as Platform>::File<'_>,
160160
symbol_index: object::SymbolIndex,
161161
) -> bool {
162162
object

libwild/src/elf_writer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,8 +3230,7 @@ fn write_epilogue<A: Arch<Platform = Elf>>(
32303230

32313231
// The actual build-id will be filled in later once all writing has completed. It's important
32323232
// that we fill it with zeros now however, since if we're overwriting an existing file, there
3233-
// might be other data there and it we don't zero it, then the build ID will be hashing that
3234-
// data.
3233+
// might be other data there and we don't zero it, then the build ID will be hashing that data.
32353234
let build_id_buffer = buffers.get_mut(part_id::NOTE_GNU_BUILD_ID);
32363235
build_id_buffer.fill(0);
32373236

libwild/src/elf_x86_64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl crate::platform::Arch for ElfX86_64 {
7676
plt_address: u64,
7777
) -> crate::error::Result {
7878
plt_entry.copy_from_slice(PLT_ENTRY_TEMPLATE);
79-
let offset: i32 = ((got_address.wrapping_sub(plt_address + 0xb)) as i64)
79+
let offset: i32 = (got_address.wrapping_sub(plt_address + 0xb) as i64)
8080
.try_into()
8181
.map_err(|_| error!("PLT is more than 2GiB away from GOT"))?;
8282
plt_entry[7..11].copy_from_slice(&offset.to_le_bytes());
@@ -91,7 +91,7 @@ impl crate::platform::Arch for ElfX86_64 {
9191
false
9292
}
9393

94-
fn tp_offset_start<'data>(layout: &crate::layout::Layout<'data, Elf>) -> u64 {
94+
fn tp_offset_start(layout: &crate::layout::Layout<Elf>) -> u64 {
9595
layout.tls_end_address()
9696
}
9797

@@ -164,9 +164,9 @@ impl crate::platform::Arch for ElfX86_64 {
164164

165165
match relocation_kind {
166166
object::elf::R_X86_64_REX_GOTPCRELX | object::elf::R_X86_64_CODE_4_GOTPCRELX
167-
if ((relocation_kind == object::elf::R_X86_64_CODE_4_GOTPCRELX
167+
if (relocation_kind == object::elf::R_X86_64_CODE_4_GOTPCRELX
168168
&& (offset >= 4 && section_bytes[offset - 4] == 0xd5))
169-
|| offset >= 3) =>
169+
|| offset >= 3 =>
170170
{
171171
let b1 = section_bytes[offset - 2];
172172
let rex = section_bytes[offset - 3];

libwild/src/file_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ pub(crate) fn split_buffers_by_alignment<'out, 'data, P: Platform>(
421421
)
422422
}
423423

424-
fn write_layout<'data, P: Platform>(layout: &Layout<'data, P>) -> Result {
424+
fn write_layout<P: Platform>(layout: &Layout<P>) -> Result {
425425
let layout_path = linker_layout::layout_path(&layout.args().output);
426426
write_layout_to(layout, &layout_path)
427427
.with_context(|| format!("Failed to write layout to `{}`", layout_path.display()))

libwild/src/grouping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn determine_max_files_per_group(args: &Args) -> usize {
225225
}
226226

227227
/// Compute the total number of symbols in the supplied objects.
228-
fn count_symbols<'data, P: Platform>(objects: &[Box<ParsedInputObject<'data, P>>]) -> usize {
228+
fn count_symbols<P: Platform>(objects: &[Box<ParsedInputObject<P>>]) -> usize {
229229
verbose_timing_phase!("Count symbols");
230230

231231
objects.iter().map(|o| o.num_symbols()).sum::<usize>()

0 commit comments

Comments
 (0)