mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-25 22:34:28 +01:00
clippy: use rewind instead of seek 0
This commit is contained in:
parent
07603373f3
commit
771a367b97
@ -198,7 +198,7 @@ impl From<KindWithContent> for KindDump {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub(crate) mod test {
|
pub(crate) mod test {
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Seek, SeekFrom};
|
use std::io::Seek;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use big_s::S;
|
use big_s::S;
|
||||||
@ -410,7 +410,7 @@ pub(crate) mod test {
|
|||||||
// create the dump
|
// create the dump
|
||||||
let mut file = tempfile::tempfile().unwrap();
|
let mut file = tempfile::tempfile().unwrap();
|
||||||
dump.persist_to(&mut file).unwrap();
|
dump.persist_to(&mut file).unwrap();
|
||||||
file.seek(SeekFrom::Start(0)).unwrap();
|
file.rewind().unwrap();
|
||||||
|
|
||||||
file
|
file
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
//!
|
//!
|
||||||
|
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{BufRead, BufReader, ErrorKind, Seek, SeekFrom};
|
use std::io::{BufRead, BufReader, ErrorKind, Seek};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -178,7 +178,7 @@ impl V5Reader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn keys(&mut self) -> Result<Box<dyn Iterator<Item = Result<Key>> + '_>> {
|
pub fn keys(&mut self) -> Result<Box<dyn Iterator<Item = Result<Key>> + '_>> {
|
||||||
self.keys.seek(SeekFrom::Start(0))?;
|
self.keys.rewind()?;
|
||||||
Ok(Box::new(
|
Ok(Box::new(
|
||||||
(&mut self.keys).lines().map(|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) }),
|
(&mut self.keys).lines().map(|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) }),
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user