refactor
This commit is contained in:
+3
-3
@@ -1,8 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt::{Display, Write};
|
use std::fmt::{Display, Write};
|
||||||
use std::fs::File;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::io::{BufReader, Lines};
|
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Eq, PartialOrd, Ord)]
|
||||||
pub struct Package {
|
pub struct Package {
|
||||||
@@ -20,7 +18,9 @@ impl From<String> for Package {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Package {
|
impl Package {
|
||||||
pub(crate) fn from_lines(lines: Lines<BufReader<File>>) -> HashSet<Self> {
|
pub(crate) fn from_lines(
|
||||||
|
lines: impl Iterator<Item = Result<String, std::io::Error>>,
|
||||||
|
) -> HashSet<Self> {
|
||||||
lines
|
lines
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|l| Package::from(l.unwrap()))
|
.map(|l| Package::from(l.unwrap()))
|
||||||
|
|||||||
Reference in New Issue
Block a user