Skip to content

Commit 0cd905f

Browse files
committed
Explain why returning a box is an anti-pattern
1 parent ceea54c commit 0cd905f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/unused_box.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ declare_clippy_lint! {
1313
///
1414
/// ### Why is this bad?
1515
///
16-
/// It's better to just return `T` in these cases
16+
/// It's better to just return `T` in these cases. The caller may not need
17+
/// the value to be boxed, and it's expensive to free the memory once the
18+
/// `Box<T>` been dropped.
1719
///
1820
/// ### Example
1921
/// ```rust

0 commit comments

Comments
 (0)