indexer: More crate updates + warning fixes + 2018 edition
This commit is contained in:
parent
c48feedc85
commit
c9e81a8922
14 changed files with 193 additions and 499 deletions
|
|
@ -4,10 +4,10 @@ use regex::Regex;
|
|||
use chrono::NaiveDateTime;
|
||||
use postgres;
|
||||
|
||||
use archive;
|
||||
use open;
|
||||
use man;
|
||||
use pkg;
|
||||
use crate::archive;
|
||||
use crate::open;
|
||||
use crate::man;
|
||||
use crate::pkg;
|
||||
|
||||
|
||||
struct Meta {
|
||||
|
|
@ -22,8 +22,7 @@ struct Meta {
|
|||
fn read_files<T: Read>(lst: T) -> Result<bool> {
|
||||
let rd = BufReader::new(lst);
|
||||
for line in rd.lines() {
|
||||
let line = try!(line);
|
||||
if man::ismanpath(&line) {
|
||||
if man::ismanpath(&line?) {
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +32,7 @@ fn read_files<T: Read>(lst: T) -> Result<bool> {
|
|||
|
||||
fn read_desc(rd: &mut archive::ArchiveEntry) -> Result<Option<Meta>> {
|
||||
let mut data = String::new();
|
||||
try!(rd.take(64*1024).read_to_string(&mut data));
|
||||
rd.take(64*1024).read_to_string(&mut data)?;
|
||||
|
||||
let path = rd.path().unwrap();
|
||||
lazy_static! {
|
||||
|
|
@ -97,9 +96,9 @@ pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, mirror: &str, repo
|
|||
hasman = false;
|
||||
meta = None;
|
||||
} else if x.path().unwrap().ends_with("/files") {
|
||||
hasman = try!(read_files(x));
|
||||
hasman = read_files(x)?;
|
||||
} else if x.path().unwrap().ends_with("/desc") {
|
||||
meta = try!(read_desc(x));
|
||||
meta = read_desc(x)?;
|
||||
}
|
||||
|
||||
if hasman && meta.is_some() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue