File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,9 @@ declare_clippy_lint! {
61
61
/// because that might induce API breakage, if the parameter is declared as mutable,
62
62
/// or if the argument is a `self`.
63
63
///
64
- /// **Why is this bad?** Arguments passed by value might require a shallow copy,
65
- /// which can be expensive and can be easily improved with passing by reference.
64
+ /// **Why is this bad?** Arguments passed by value might result in an unnecessary
65
+ /// shallow copy, taking up more space in the stack and requiring a call to
66
+ /// `memcpy`, which which can be expensive.
66
67
///
67
68
/// **Example:**
68
69
///
@@ -73,9 +74,11 @@ declare_clippy_lint! {
73
74
/// // Bad
74
75
/// fn foo(v: TooLarge) {}
75
76
/// ```
76
- ///
77
77
/// ```rust
78
- /// // Better
78
+ /// #[derive(Clone, Copy)]
79
+ /// struct TooLarge([u8; 2048]);
80
+ ///
81
+ /// // Good
79
82
/// fn foo(v: &TooLarge) {}
80
83
/// ```
81
84
pub LARGE_TYPES_PASSED_BY_VALUE ,
You can’t perform that action at this time.
0 commit comments