Task #108442 - added.err

back to task #108442
download
Error: CLIPPY_WARNING:
crates/openshell-providers/src/providers/vertex.rs:48:17: warning: use Option::map_or_else instead of an if let/else
#     |
#  48 | /                 if let Ok(custom_path) = std::env::var("GOOGLE_APPLICATION_CREDENTIALS") {
#  49 | |                     std::path::Path::new(&custom_path).exists()
#  50 | |                 } else {
#  51 | |                     let default_path = format!(
#  ...  |
#  55 | |                     std::path::Path::new(&default_path).exists()
#  56 | |                 };
#     | |_________________^
#     |
#     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#option_if_let_else
#     = note: `-W clippy::option-if-let-else` implied by `-W clippy::nursery`
#     = help: to override `-W clippy::nursery` add `#[allow(clippy::option_if_let_else)]`
#  help: try
#     |
#  48 ~                 std::env::var("GOOGLE_APPLICATION_CREDENTIALS").map_or_else(|_| {
#  49 +                     let default_path = format!(
#  50 +                         "{}/.config/gcloud/application_default_credentials.json",
#  51 +                         std::env::var("HOME").unwrap_or_default()
#  52 +                     );
#  53 +                     std::path::Path::new(&default_path).exists()
#  54 ~                 }, |custom_path| std::path::Path::new(&custom_path).exists());
#     |