Use functional paradigm for file reading.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-03-09 16:59:30 +01:00
parent df7017518e
commit 374bc02b50

View File

@ -50,12 +50,9 @@ fn main()
{
let in_file = File::open(opts.import.unwrap()).unwrap();
let reader = BufReader::new(in_file);
for line in reader.lines()
{
let line = line.unwrap();
let aux:u64 = line.parse().unwrap();
primes.push_back(aux);
}
reader.lines().into_iter().for_each(|x| {
primes.push_back(x.unwrap().parse().unwrap());
});
}
if opts.test