Skip to content

Conversation

@GnomedDev
Copy link
Contributor

@GnomedDev GnomedDev commented Oct 10, 2024

Currently some warn-by-default lints fire in the tests, this PR fixes up the existing warnings, then adds pedantic and some nursery lints in for good luck.

Copy link

@hkBst hkBst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a few minor things.

@nicoburns
Copy link
Collaborator

As noted in #60, I can compile thin-vec with Rust 1.53 today. Until such time as we have a proper MSRV policy (with key consumers consulted) I'm going to try to keep compatibility to 1.53.

@GnomedDev GnomedDev force-pushed the clippy branch 2 times, most recently from 152d35e to 7e7f407 Compare August 25, 2025 11:42
@GnomedDev
Copy link
Contributor Author

@nicoburns Sorted out the MSRV, the CI failures, and hkBst's comments.

Comment on lines -311 to +316
_len: SizeType,
_cap: SizeType,
len: SizeType,
cap: SizeType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this crate is designed to support FFI with an equivalent vectors type in Gecko's C++ code, I think we may need to keep the field names as they were. It's probably possible to change them here with an change to Gecko's bindgen code, but also probably not worth the bother?

Can we just ignore this lint?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this, the names are already different in Gecko.

Comment on lines -408 to +422
final_size as usize
final_size
.try_into()
.expect("cannot allocate object larger than isize")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of try_into for these casts seems like it could cause a perf regression? Which seems a bit unnecessary given that we can be confident that they will always succeed.

Do you have a motivation for changing them other than that the lint says to?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'd leave these casts as they are.

Comment on lines -311 to +316
_len: SizeType,
_cap: SizeType,
len: SizeType,
cap: SizeType,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this, the names are already different in Gecko.

Comment on lines -408 to +422
final_size as usize
final_size
.try_into()
.expect("cannot allocate object larger than isize")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'd leave these casts as they are.

/// ```
pub fn dedup(&mut self) {
self.dedup_by(|a, b| a == b)
self.dedup_by(|a, b| a == b);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes also feel pretty random.

@emilio
Copy link
Collaborator

emilio commented Aug 25, 2025

Would be good to split this PR (or the commits at least) in formatting changes, then style changes (which shouldn't have perf impact) then others.

@GnomedDev
Copy link
Contributor Author

Okay, I don't have the free time for now to work on that. Anyone is free to take up the mantle either from scratch or based on this PR.

@GnomedDev GnomedDev closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants