File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
clippy_lints/src/operators Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ pub(crate) fn check<'tcx>(
8686 left. span ,
8787 "use the left value directly" ,
8888 lsnip,
89- Applicability :: MaybeIncorrect , // FIXME #2597
89+ Applicability :: MachineApplicable ,
9090 ) ;
9191 } ,
9292 ) ;
@@ -105,7 +105,7 @@ pub(crate) fn check<'tcx>(
105105 right. span ,
106106 "use the right value directly" ,
107107 rsnip,
108- Applicability :: MaybeIncorrect , // FIXME #2597
108+ Applicability :: MachineApplicable ,
109109 ) ;
110110 } ,
111111 ) ;
@@ -137,7 +137,7 @@ pub(crate) fn check<'tcx>(
137137 left. span ,
138138 "use the left value directly" ,
139139 lsnip,
140- Applicability :: MaybeIncorrect , // FIXME #2597
140+ Applicability :: MachineApplicable ,
141141 ) ;
142142 } ,
143143 ) ;
@@ -164,7 +164,7 @@ pub(crate) fn check<'tcx>(
164164 right. span ,
165165 "use the right value directly" ,
166166 rsnip,
167- Applicability :: MaybeIncorrect , // FIXME #2597
167+ Applicability :: MachineApplicable ,
168168 ) ;
169169 } ) ;
170170 }
Original file line number Diff line number Diff line change @@ -98,3 +98,15 @@ impl Mul<A> for A {
9898 self * &rhs
9999 }
100100}
101+
102+ mod issue_2597 {
103+ fn ex1() {
104+ let a: &str = "abc";
105+ let b: String = "abc".to_owned();
106+ println!("{}", a > &b);
107+ }
108+
109+ pub fn ex2<T: Ord + PartialOrd>(array: &[T], val: &T, idx: usize) -> bool {
110+ &array[idx] < val
111+ }
112+ }
Original file line number Diff line number Diff line change @@ -98,3 +98,15 @@ impl Mul<A> for A {
9898 self * & rhs
9999 }
100100}
101+
102+ mod issue_2597 {
103+ fn ex1 ( ) {
104+ let a: & str = "abc" ;
105+ let b: String = "abc" . to_owned ( ) ;
106+ println ! ( "{}" , a > & b) ;
107+ }
108+
109+ pub fn ex2 < T : Ord + PartialOrd > ( array : & [ T ] , val : & T , idx : usize ) -> bool {
110+ & array[ idx] < val
111+ }
112+ }
You can’t perform that action at this time.
0 commit comments