While looking into https://github.com/rust-lang/rust-clippy/issues/15569, I stumbled upon `clippy_utils::ptr`. This module was created in https://github.com/rust-lang/rust-clippy/pull/2117, to share the logic from `ptr_arg` with `needless_pass_by_value`. But then later, https://github.com/rust-lang/rust-clippy/pull/8409 removed the use of the logic from `ptr_arg`, which left `needless_pass_by_value` as the only user of this module. Still, I wanted to try to add docs to the module, but the two functions looked all too specific, so I thought it'd be better to just move them to `needless_pass_by_value`, in the hopes that whoever is looking at that lint will hopefully have enough context to understand what those functions are doing. changelog: none
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-09-18
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.