Checks for ?
operators embedded within a larger expression.
It can be easy to overlook the ?
. Code is more readable when a ?
is the outermost
operator in an expression.
Ok(PathBuf::from(&var("PWD")?))
Use instead:
let val = var("PWD")?;
Ok(PathBuf::from(&val))