File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ pub struct TypePass;
36
36
/// values: Box<Vec<Foo>>,
37
37
/// }
38
38
/// ```
39
+ ///
40
+ /// Better:
41
+ ///
42
+ /// ```rust
43
+ /// struct X {
44
+ /// values: Vec<Foo>,
45
+ /// }
46
+ /// ```
39
47
declare_lint ! {
40
48
pub BOX_VEC ,
41
49
Warn ,
@@ -89,6 +97,12 @@ declare_lint! {
89
97
/// ```rust
90
98
/// fn foo(bar: &Box<T>) { ... }
91
99
/// ```
100
+ ///
101
+ /// Better:
102
+ ///
103
+ /// ```rust
104
+ /// fn foo(bar: &T) { ... }
105
+ /// ```
92
106
declare_lint ! {
93
107
pub BORROWED_BOX ,
94
108
Warn ,
@@ -514,6 +528,12 @@ declare_lint! {
514
528
/// ```rust
515
529
/// fn as_u64(x: u8) -> u64 { x as u64 }
516
530
/// ```
531
+ ///
532
+ /// Using `::from` would look like this:
533
+ ///
534
+ /// ```rust
535
+ /// fn as_u64(x: u8) -> u64 { u64::from(x) }
536
+ /// ```
517
537
declare_lint ! {
518
538
pub CAST_LOSSLESS ,
519
539
Warn ,
@@ -994,6 +1014,12 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
994
1014
/// ```rust
995
1015
/// 'x' as u8
996
1016
/// ```
1017
+ ///
1018
+ /// A better version, using the byte literal:
1019
+ ///
1020
+ /// ```rust
1021
+ /// b'x'
1022
+ /// ```
997
1023
declare_lint ! {
998
1024
pub CHAR_LIT_AS_U8 ,
999
1025
Warn ,
You can’t perform that action at this time.
0 commit comments