Skip to content

Commit 9abd8b3

Browse files
committed
Fix/mute clippy errors
1 parent 0b9e65d commit 9abd8b3

File tree

12 files changed

+15
-10
lines changed

12 files changed

+15
-10
lines changed

bottlecap/src/config/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl ConfigBuilder {
197197
// or in the `proxy_no_proxy` config field.
198198
if self.config.proxy_https.is_some() {
199199
let site_in_no_proxy = std::env::var("NO_PROXY")
200-
.map_or(false, |no_proxy| no_proxy.contains(&self.config.site))
200+
.is_ok_and(|no_proxy| no_proxy.contains(&self.config.site))
201201
|| self
202202
.config
203203
.proxy_no_proxy
@@ -543,7 +543,7 @@ where
543543
{
544544
struct KeyValueVisitor;
545545

546-
impl<'de> serde::de::Visitor<'de> for KeyValueVisitor {
546+
impl serde::de::Visitor<'_> for KeyValueVisitor {
547547
type Value = HashMap<String, String>;
548548

549549
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

bottlecap/src/lifecycle/invocation/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn create_empty_span(name: String, resource: &str, service: &str) -> Span {
4343

4444
#[must_use]
4545
pub fn generate_span_id() -> u64 {
46-
if std::env::var(INIT_TYPE).map_or(false, |it| it == SNAP_START_VALUE) {
46+
if std::env::var(INIT_TYPE).is_ok_and(|it| it == SNAP_START_VALUE) {
4747
return OsRng.next_u64();
4848
}
4949

bottlecap/src/lifecycle/invocation/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl Processor {
898898

899899
let is_error = headers
900900
.get(DATADOG_INVOCATION_ERROR_KEY)
901-
.map_or(false, |v| v.to_lowercase() == "true")
901+
.is_some_and(|v| v.to_lowercase() == "true")
902902
|| message.is_some()
903903
|| stack.is_some()
904904
|| r#type.is_some()

bottlecap/src/lifecycle/invocation/triggers/event_bridge_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Trigger for EventBridgeEvent {
4747
&& payload
4848
.get("source")
4949
.and_then(Value::as_str)
50-
.map_or(false, |s| s != "aws.events")
50+
.is_some_and(|s| s != "aws.events")
5151
}
5252

5353
#[allow(clippy::cast_possible_truncation)]

bottlecap/src/lifecycle/invocation/triggers/lambda_function_url_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Trigger for LambdaFunctionUrlEvent {
5959
.get("requestContext")
6060
.and_then(|rc| rc.get("domainName"))
6161
.and_then(Value::as_str)
62-
.map_or(false, |dn| dn.contains("lambda-url"))
62+
.is_some_and(|dn| dn.contains("lambda-url"))
6363
}
6464

6565
#[allow(clippy::cast_possible_truncation)]

bottlecap/src/lifecycle/invocation/triggers/msk_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Trigger for MSKEvent {
5555
.and_then(|map| map.values().next())
5656
.and_then(Value::as_array)
5757
.and_then(|arr| arr.first())
58-
.map_or(false, |rec| rec.get("topic").is_some())
58+
.is_some_and(|rec| rec.get("topic").is_some())
5959
}
6060

6161
#[allow(clippy::cast_possible_truncation)]

bottlecap/src/lifecycle/invocation/triggers/sqs_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl Trigger for SqsRecord {
9393
first_record
9494
.get("eventSource")
9595
.and_then(Value::as_str)
96-
.map_or(false, |s| s == "aws:sqs")
96+
.is_some_and(|s| s == "aws:sqs")
9797
} else {
9898
false
9999
}

bottlecap/src/otlp/agent.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ impl Agent {
7171
self.cancel_token.clone()
7272
}
7373

74+
// TODO (Yiming): Fix this lint
75+
#[allow(clippy::ref_option)]
7476
fn parse_port(endpoint: &Option<String>, default_port: u16) -> u16 {
7577
if let Some(endpoint) = endpoint {
7678
let port = endpoint.split(':').nth(1);

bottlecap/src/proc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn get_network_data_from_path(path: &str) -> Result<NetworkData, io::Error> {
6060
let line = line?;
6161
let mut values = line.split_whitespace();
6262

63-
if values.next().map_or(false, |interface_name| {
63+
if values.next().is_some_and(|interface_name| {
6464
interface_name.starts_with(LAMBDA_NETWORK_INTERFACE)
6565
|| interface_name.starts_with(LAMBDA_RUNTIME_NETWORK_INTERFACE)
6666
}) {

bottlecap/src/proxy/interceptor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ async fn graceful_shutdown(tasks: Arc<Mutex<JoinSet<()>>>, shutdown_token: Cance
110110
/// If the LWA proxy lambda runtime API is not provided, the default Extension
111111
/// host and port will be used.
112112
///
113+
// TODO (Yiming): Fix this lint
114+
#[allow(clippy::ref_option)]
113115
fn get_proxy_socket_address(aws_lwa_proxy_lambda_runtime_api: &Option<String>) -> SocketAddr {
114116
if let Some(socket_addr) = aws_lwa_proxy_lambda_runtime_api
115117
.as_ref()

0 commit comments

Comments
 (0)