Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Use maybe_load instead of if_present for load_project_info
Browse files Browse the repository at this point in the history
This only affects `wrangler report`. The old behavior preserved the
behavior from before, but was less helpful because it wouldn't include
the ID if there was only a single ID for the account token.
  • Loading branch information
jyn514 committed Jun 28, 2021
1 parent 749c8b7 commit d699809
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/reporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,7 @@ fn load_project_info() -> ProjectInfo {
.insert("script_name".into(), manifest.name);
project_info.base.insert(
"account_id".into(),
manifest
.account_id
.if_present()
.cloned()
.unwrap_or_default(),
manifest.account_id.maybe_load().unwrap_or_default(),
);
project_info.base.insert(
"zone_id".into(),
Expand Down
2 changes: 1 addition & 1 deletion src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl LazyAccountId {
/// Return the `account_id` in `wrangler.toml`, if present.
///
/// Use this with caution; prefer `maybe_load` instead where possible.
pub(crate) fn if_present(&self) -> Option<&String> {
fn if_present(&self) -> Option<&String> {
self.0.get()
}

Expand Down

0 comments on commit d699809

Please sign in to comment.