Skip to content

Commit

Permalink
Merge pull request #59 from statsig-io/format-things
Browse files Browse the repository at this point in the history
apply linter
  • Loading branch information
ealui-statsig committed Mar 29, 2024
2 parents 7806f9c + 8838961 commit 66696ab
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sha2::{Digest, Sha256};
use crate::statsig::internal::data_types::APISpec;
use crate::statsig::internal::statsig_store::StatsigStore;
use crate::statsig::internal::EvalResult;
use crate::{unwrap_or_return, StatsigUser};
use crate::{unwrap_or_return, unwrap_or_noop, StatsigUser};

type SecondaryExposures = Option<Vec<HashMap<String, String>>>;

Expand Down Expand Up @@ -171,7 +171,7 @@ fn populate_layer_fields(
);
result.insert("undelegated_secondary_exposures".into(), json!([]));

let delegate = unwrap_or_return!(&eval_result.config_delegate, ());
let delegate = unwrap_or_noop!(&eval_result.config_delegate);
if delegate.is_empty() {
return;
}
Expand Down
10 changes: 10 additions & 0 deletions src/statsig/internal/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ macro_rules! unwrap_or_return {
}
};
}

#[macro_export]
macro_rules! unwrap_or_noop {
($res: expr) => {
match $res {
Some(v) => v,
None => return,
}
};
}
1 change: 1 addition & 0 deletions src/statsig/internal/statsig_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ impl StatsigLogger {
let events = self.events.clone();
let network = self.network.clone();

#[allow(clippy::await_holding_lock)]
self.runtime_handle.block_on(async move {
// Purposely hold onto the running jobs lock while waiting for
// all job handles to complete to ensure no new job handles
Expand Down
2 changes: 1 addition & 1 deletion src/statsig/internal/statsig_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl StatsigNetwork {
}

if let Ok(no_updates) = from_value::<APIDownloadedConfigsNoUpdates>(json_value.clone()) {
if no_updates.has_updates == false {
if !no_updates.has_updates {
return Some(NoUpdates(no_updates));
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/statsig/statsig_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub struct StatsigOptions {
pub disable_user_agent_support: bool,
}

impl StatsigOptions {
pub fn default() -> StatsigOptions {
impl Default for StatsigOptions {
fn default() -> StatsigOptions {
StatsigOptions {
environment: None,
api_override: "https://statsigapi.net/v1".to_string(),
Expand Down

0 comments on commit 66696ab

Please sign in to comment.