Skip to content

Commit

Permalink
ref(relay): Fix rust beta lints (#3920)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Aug 12, 2024
1 parent 1a35ad6 commit 609dc91
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion relay-metrics/src/meta/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ impl RedisMetricMetaStore {
let expire_at = meta.timestamp.as_secs() + self.expiry.as_secs();
pipe.cmd("EXPIREAT").arg(key).arg(expire_at).ignore();
}
pipe.query(&mut connection).map_err(RedisError::Redis)?;
pipe.query::<()>(&mut connection)
.map_err(RedisError::Redis)?;

relay_statsd::metric!(counter(MetricCounters::MetaRedisUpdate) += redis_updates);

Expand Down
2 changes: 1 addition & 1 deletion relay-pii/src/attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ impl<'a> PiiAttachmentsProcessor<'a> {

/// Scrub a filepath, preserving the basename.
pub fn scrub_utf8_filepath(&self, path: &mut str, state: &ProcessingState<'_>) -> bool {
if let Some(index) = path.rfind(|c| c == '/' || c == '\\') {
if let Some(index) = path.rfind(['/', '\\']) {
let data = unsafe { &mut path.as_bytes_mut()[..index] };
self.scrub_bytes(data, state, ScrubEncodings::Utf8)
} else {
Expand Down
5 changes: 2 additions & 3 deletions relay-pii/src/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ impl DataScrubbingConfig {
/// Like [`pii_config`](Self::pii_config) but without internal caching.
#[inline]
pub fn pii_config_uncached(&self) -> Result<Option<PiiConfig>, PiiConfigError> {
convert::to_pii_config(self).map_err(|e| {
convert::to_pii_config(self).inspect_err(|e| {
relay_log::error!(
error = &e as &dyn std::error::Error,
error = e as &dyn std::error::Error,
"failed to convert datascrubbing config"
);
e
})
}
}
2 changes: 1 addition & 1 deletion relay-pii/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<'a> Processor for PiiProcessor<'a> {
// string. If we decide that we need to preserve anything other than suffixes all PII
// tooltips/annotations are potentially wrong.

if let Some(index) = value.rfind(|c| c == '/' || c == '\\') {
if let Some(index) = value.rfind(['/', '\\']) {
let basename = value.split_off(index);
match self.process_string(value, meta, state) {
Ok(()) => value.push_str(&basename),
Expand Down
2 changes: 1 addition & 1 deletion relay-sampling/src/redis_sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ pub fn set_redis_expiry(
relay_redis::redis::cmd("EXPIRE")
.arg(key.as_str())
.arg(expiry_time - now)
.query(redis_connection)?;
.query::<()>(redis_connection)?;
Ok(())
}
5 changes: 2 additions & 3 deletions relay-server/src/services/processor/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ pub fn extract<G: EventProcessing>(
})?
} else if let Some(item) = nel_item {
relay_log::trace!("processing nel report");
event_from_nel_item(item, envelope.meta()).map_err(|error| {
relay_log::error!(error = &error as &dyn Error, "failed to extract NEL report");
error
event_from_nel_item(item, envelope.meta()).inspect_err(|error| {
relay_log::error!(error = error as &dyn Error, "failed to extract NEL report");
})?
} else if attachment_item.is_some() || breadcrumbs1.is_some() || breadcrumbs2.is_some() {
relay_log::trace!("extracting attached event data");
Expand Down

0 comments on commit 609dc91

Please sign in to comment.