src/tools/procfs.rs: avoid useless allocations

This commit is contained in:
Dietmar Maurer 2019-04-24 09:35:15 +02:00
parent 0283da04e6
commit d8871f2f18
1 changed files with 1 additions and 1 deletions

View File

@ -386,7 +386,7 @@ pub fn read_proc_net_ipv6_route() -> Result<Vec<ProcFsNetIPv6Route>, Error> {
let mut iter = content.split_whitespace(); let mut iter = content.split_whitespace();
let mut next = || iter.next() let mut next = || iter.next()
.ok_or(format_err!("Error while parsing '{}'", path)); .ok_or_else(|| format_err!("Error while parsing '{}'", path));
let (dest, prefix) = (next()?, next()?); let (dest, prefix) = (next()?, next()?);
for _ in 0..2 { next()?; } for _ in 0..2 { next()?; }