rust/clippy_utils
llogiq 741b684c90
New lint - same_length_and_capacity (#15656)
Fixes rust-lang/rust-clippy#5955

I understand that there's a feature freeze right now. I had started
working on this before I was aware of the feature freeze. I don't mind
waiting as long as I need to for feedback.

changelog: [`same_length_and_capacity`]: adds a new lint that checks for
usages of `from_raw_parts` where the same expression is passed for the
length and the capacity

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Feature-freeze](https://github.com/rust-lang/rust-clippy/pull/15656#issuecomment-3276620004)
by [github-actions[bot]](https://github.com/github-actions[bot])

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
2025-12-18 13:55:44 +00:00
..
src New lint - same_length_and_capacity (#15656) 2025-12-18 13:55:44 +00:00
Cargo.toml Bump Clippy version -> 0.1.94 2025-12-11 18:48:15 +01:00
README.md Bump nightly version -> 2025-12-11 2025-12-11 18:48:10 +01:00

clippy-utils

Helpful tools for writing lints, provided as they are used in Clippy.

Usage

This crate is only guaranteed to build with this nightly toolchain:

nightly-2025-12-11

To use clippy-utils in your lint, add the following to your Cargo.toml:

clippy_utils = "0.1.XY"

XY is the version of the nightly toolchain above and can be determined with rustc +nightly-YYYY-MM-DD -V.

⚠️ Stability ⚠️

No stability guarantees are made for this crate! Use at your own risk.

Function signatures can change or be removed without replacement without any prior notice.

LICENSE

Copyright 2014-2025 The Rust Project Developers

Licensed under the Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> or the MIT license <https://opensource.org/licenses/MIT>, at your option. Files in the project may not be copied, modified, or distributed except according to those terms.