src/tools/procfs.rs: avoid useless allocations
This commit is contained in:
parent
0283da04e6
commit
d8871f2f18
|
@ -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()?; }
|
||||||
|
|
Loading…
Reference in New Issue