Skip to content

Commit ad5ab8f

Browse files
committed
fmt
Signed-off-by: Eren Atas <[email protected]>
1 parent df62b0e commit ad5ab8f

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

crates/flagd/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,10 @@ impl FlagdProvider {
471471
value_converter: impl Fn(Value) -> Option<T>,
472472
) -> Option<T> {
473473
if let Some(cache) = &self.cache
474-
&& let Some(cached_value) = cache.get(flag_key, context).await {
475-
return value_converter(cached_value);
476-
}
474+
&& let Some(cached_value) = cache.get(flag_key, context).await
475+
{
476+
return value_converter(cached_value);
477+
}
477478
None
478479
}
479480
}

crates/flagd/src/resolver/in_process/resolver/file.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ impl FileResolver {
5151
type_name: &str,
5252
) -> Result<ResolutionDetails<T>, EvaluationError> {
5353
if let Some(cache) = &self.cache
54-
&& let Some(cached_value) = cache.get(flag_key, context).await {
55-
debug!("Cache hit for key: {}", flag_key);
56-
let json_value = cached_value.to_serde_json();
57-
if let Some(value) = value_converter(&json_value) {
58-
return Ok(ResolutionDetails::new(value));
59-
}
54+
&& let Some(cached_value) = cache.get(flag_key, context).await
55+
{
56+
debug!("Cache hit for key: {}", flag_key);
57+
let json_value = cached_value.to_serde_json();
58+
if let Some(value) = value_converter(&json_value) {
59+
return Ok(ResolutionDetails::new(value));
6060
}
61+
}
6162

6263
let query_result = self.store.get_flag(flag_key).await;
6364

crates/flagd/src/resolver/in_process/resolver/grpc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ impl InProcessResolver {
8686
value_converter: impl Fn(&OpenFeatureValue) -> Option<T>,
8787
) -> Option<T> {
8888
if let Some(cache) = &self.cache
89-
&& let Some(cached_value) = cache.get(flag_key, context).await {
90-
return value_converter(&cached_value);
91-
}
89+
&& let Some(cached_value) = cache.get(flag_key, context).await
90+
{
91+
return value_converter(&cached_value);
92+
}
9293
None
9394
}
9495

crates/flagd/src/resolver/rpc.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,19 @@ impl RpcResolver {
159159

160160
// Extend support for envoy names resolution
161161
if let Some(uri) = &options.target_uri
162-
&& uri.starts_with("envoy://") {
163-
// Expected format: envoy://<host:port>/<desired_authority>
164-
let without_prefix = uri.trim_start_matches("envoy://");
165-
let segments: Vec<&str> = without_prefix.split('/').collect();
166-
if segments.len() >= 2 {
167-
let authority_str = segments[1];
168-
// Create a full URI from the authority for endpoint.origin()
169-
let authority_uri =
170-
std::str::FromStr::from_str(&format!("http://{}", authority_str))?;
171-
endpoint = endpoint.origin(authority_uri);
172-
}
162+
&& uri.starts_with("envoy://")
163+
{
164+
// Expected format: envoy://<host:port>/<desired_authority>
165+
let without_prefix = uri.trim_start_matches("envoy://");
166+
let segments: Vec<&str> = without_prefix.split('/').collect();
167+
if segments.len() >= 2 {
168+
let authority_str = segments[1];
169+
// Create a full URI from the authority for endpoint.origin()
170+
let authority_uri =
171+
std::str::FromStr::from_str(&format!("http://{}", authority_str))?;
172+
endpoint = endpoint.origin(authority_uri);
173173
}
174+
}
174175

175176
let channel = endpoint
176177
.timeout(Duration::from_millis(options.deadline_ms as u64))

0 commit comments

Comments
 (0)