diff options
| author | bors <bors@rust-lang.org> | 2022-01-11 17:07:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-11 17:07:50 +0000 |
| commit | 88f5be2041acca3da00648ffc10846dab25cfb5f (patch) | |
| tree | 7b87f1fda6752573897674704a088108e7a209a5 | |
| parent | fd9cebe6eb876117bb5e1252114e471a3508ec25 (diff) | |
| parent | 7e989ec07a2725c8ba88f2030ef7099bb44f08e6 (diff) | |
| download | rust-88f5be2041acca3da00648ffc10846dab25cfb5f.tar.gz rust-88f5be2041acca3da00648ffc10846dab25cfb5f.zip | |
Auto merge of #8262 - 1nF0rmed:chore-update-borrowed-box-doc, r=camsteffen
Improve documentation for `borrowed-box` lint fixes #8161 Updates documentation to elaborate more on how removing Box from a function parameter can generalize the function. changelog: none
| -rw-r--r-- | clippy_lints/src/types/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/types/mod.rs b/clippy_lints/src/types/mod.rs index 481e5957435..9d57505e55e 100644 --- a/clippy_lints/src/types/mod.rs +++ b/clippy_lints/src/types/mod.rs @@ -167,8 +167,9 @@ declare_clippy_lint! { /// Check the [Box documentation](https://doc.rust-lang.org/std/boxed/index.html) for more information. /// /// ### Why is this bad? - /// Any `&Box<T>` can also be a `&T`, which is more - /// general. + /// A `&Box<T>` parameter requires the function caller to box `T` first before passing it to a function. + /// Using `&T` defines a concrete type for the parameter and generalizes the function, this would also + /// auto-deref to `&T` at the function call site if passed a `&Box<T>`. /// /// ### Example /// ```rust,ignore |
