fix: not suggest seek_to_start_instead_of_rewind when expr is used
This commit is contained in:
parent
3b67e6af9e
commit
c39849a34d
4 changed files with 18 additions and 2 deletions
|
|
@ -70,6 +70,12 @@ fn seek_to_end<T: Seek>(t: &mut T) {
|
|||
t.seek(SeekFrom::End(0));
|
||||
}
|
||||
|
||||
// This should NOT trigger clippy warning because
|
||||
// expr is used here
|
||||
fn seek_to_start_in_let<T: Seek>(t: &mut T) {
|
||||
let a = t.seek(SeekFrom::Start(0)).unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut f = OpenOptions::new()
|
||||
.write(true)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ fn seek_to_end<T: Seek>(t: &mut T) {
|
|||
t.seek(SeekFrom::End(0));
|
||||
}
|
||||
|
||||
// This should NOT trigger clippy warning because
|
||||
// expr is used here
|
||||
fn seek_to_start_in_let<T: Seek>(t: &mut T) {
|
||||
let a = t.seek(SeekFrom::Start(0)).unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut f = OpenOptions::new()
|
||||
.write(true)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ LL | t.seek(SeekFrom::Start(0));
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()`
|
||||
|
||||
error: used `seek` to go to the start of the stream
|
||||
--> $DIR/seek_to_start_instead_of_rewind.rs:128:7
|
||||
--> $DIR/seek_to_start_instead_of_rewind.rs:134:7
|
||||
|
|
||||
LL | f.seek(SeekFrom::Start(0));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue