@@ -261,8 +261,59 @@ declare_clippy_lint! {
261261 /// ### Example
262262 /// ```no_run
263263 /// # use std::rc::Rc;
264- /// struct Foo {
265- /// inner: Rc<Vec<Vec<Box<(u32, u32, u32, u32)>>>>,
264+ /// struct PointMatrixContainer {
265+ /// matrix: Rc<Vec<Vec<Box<(u32, u32, u32, u32)>>>>,
266+ /// }
267+ ///
268+ /// fn main() {
269+ /// let point_matrix: Vec<Vec<Box<(u32, u32, u32, u32)>>> = vec![
270+ /// vec![
271+ /// Box::new((1, 2, 3, 4)),
272+ /// Box::new((5, 6, 7, 8)),
273+ /// ],
274+ /// vec![
275+ /// Box::new((9, 10, 11, 12)),
276+ /// ],
277+ /// ];
278+ ///
279+ /// let shared_point_matrix: Rc<Vec<Vec<Box<(u32, u32, u32, u32)>>>> = Rc::new(point_matrix);
280+ ///
281+ /// let container = PointMatrixContainer {
282+ /// matrix: shared_point_matrix,
283+ /// };
284+ ///
285+ /// // ...
286+ /// }
287+ /// ```
288+ /// Use instead:
289+ /// ### Example
290+ /// ```no_run
291+ /// # use std::rc::Rc;
292+ /// type PointMatrix = Vec<Vec<Box<(u32, u32, u32, u32)>>>;
293+ /// type SharedPointMatrix = Rc<PointMatrix>;
294+ ///
295+ /// struct PointMatrixContainer {
296+ /// matrix: SharedPointMatrix,
297+ /// }
298+ ///
299+ /// fn main() {
300+ /// let point_matrix: PointMatrix = vec![
301+ /// vec![
302+ /// Box::new((1, 2, 3, 4)),
303+ /// Box::new((5, 6, 7, 8)),
304+ /// ],
305+ /// vec![
306+ /// Box::new((9, 10, 11, 12)),
307+ /// ],
308+ /// ];
309+ ///
310+ /// let shared_point_matrix: SharedPointMatrix = Rc::new(point_matrix);
311+ ///
312+ /// let container = PointMatrixContainer {
313+ /// matrix: shared_point_matrix,
314+ /// };
315+ ///
316+ /// // ...
266317 /// }
267318 /// ```
268319 #[ clippy:: version = "pre 1.29.0" ]
0 commit comments