Page MenuHomeDevCentral

Lazy evaluate default values
ClosedPublic

Authored by dereckson on May 30 2020, 22:52.

Details

Summary

The unwrap_or_else method allows to pass a closure,
and so allows lazy evaluation of the argument.

Test Plan

println!("Mounting at {}", entry_point);

Diff Detail

Repository
rLF Limiting Factor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dereckson created this revision.

I'm not sure the performance improvement justify a commit. These kind of optimization can probably be done by the compiler because String::from("/") have no side effect.

This revision is now accepted and ready to land.Thu, Sep 24, 20:05
This revision was automatically updated to reflect the committed changes.