You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
malbarbo opened this issue
Jun 15, 2016
· 5 comments
Labels
C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
use std::ops::Index;structS(Vec<u32>);implIndex<usize>forS{typeOutput = u32;fnindex(&self,index:usize) -> &u32{&self.0[index]}}fnmain(){let s = S(vec![1,2,3]);for i in0..3{println!("{:?}", s[i]);}}
Clippy says "Consider using for item in s.iter().take(3), but s does not have iter method.
The text was updated successfully, but these errors were encountered:
mcarton
added
C-bug
Category: Clippy is not doing the correct thing
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-middle
Type: Probably requires verifiying types
labels
Jun 15, 2016
The check early returns when the type has no .iter() method:
// don't lint if the container that is indexed does not have .iter() methodlet has_iter = has_iter_method(cx, indexed_ty);if has_iter.is_none(){return;}
C-bugCategory: Clippy is not doing the correct thingE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying types
In this example:
Clippy says "Consider using
for item in s.iter().take(3)
, buts
does not haveiter
method.The text was updated successfully, but these errors were encountered: