Skip to content

Commit

Permalink
poe: fixes nightly clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed May 25, 2024
1 parent bbd8525 commit 55f0664
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 34 deletions.
1 change: 1 addition & 0 deletions app/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use web_sys::HtmlElement;

use crate::utils::{from_ref, reflect_set};

/// Test make clippy happy
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen]
Expand Down
12 changes: 6 additions & 6 deletions worker-sentry/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ impl Sentry {

transaction.timestamp = Some(protocol::Timestamp::now());
transaction.release = Some(git_version!().into());
transaction.request = self.request.clone();
transaction.user = self.user.clone();
transaction.breadcrumbs = self.breadcrumbs.clone();
transaction.request.clone_from(&self.request);
transaction.user.clone_from(&self.user);
transaction.breadcrumbs.clone_from(&self.breadcrumbs);
transaction
.contexts
.insert("trace".into(), protocol::Context::Trace(trace_context));
Expand Down Expand Up @@ -150,11 +150,11 @@ impl Sentry {
.as_ref()
.and_then(|t| t.0.name.to_owned())
.map(Into::into);
event.breadcrumbs = self.breadcrumbs.clone();
event.breadcrumbs.clone_from(&self.breadcrumbs);
event.release = Some(git_version!().into());
event.server_name = server_name;
event.request = self.request.clone();
event.user = self.user.clone();
event.request.clone_from(&self.request);
event.user.clone_from(&self.user);

let tc = self
.trace_context
Expand Down
23 changes: 1 addition & 22 deletions worker-sentry/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ pub fn serialize_id<S: serde::Serializer>(
}

pub mod ts_rfc3339 {
use std::fmt;

use serde::{de, ser};
use serde::ser;

use super::*;

Expand All @@ -40,25 +38,6 @@ pub mod ts_rfc3339 {
))),
}
}

pub(super) struct Rfc3339Deserializer;

impl<'de> de::Visitor<'de> for Rfc3339Deserializer {
type Value = Timestamp;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "an RFC3339 timestamp")
}

fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where
E: de::Error,
{
let dt = OffsetDateTime::parse(v, &Rfc3339).map_err(|e| E::custom(format!("{e}")))?;
let secs = u64::try_from(dt.unix_timestamp()).map_err(|e| E::custom(format!("{e}")))?;
Ok(Timestamp::from_secs(secs))
}
}
}

pub mod ts_rfc3339_opt {
Expand Down
4 changes: 2 additions & 2 deletions worker/src/dangerous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ impl Dangerous {
}

#[tracing::instrument(skip(self))]
pub async fn sign<T: Serialize>(&self, data: &T) -> Result<String>
pub async fn sign<T>(&self, data: &T) -> Result<String>
where
T: std::fmt::Debug,
T: Serialize + std::fmt::Debug,
{
let mut payload = serde_json::to_vec(data).map_err(|_| DangerousError::Serialize)?;

Expand Down
8 changes: 4 additions & 4 deletions worker/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl PartialMeta for &StoredPaste {
return;
};
meta.ascendancy_or_class = Some(this.ascendancy_or_class);
meta.main_skill_name = this.main_skill_name.clone();
meta.version = this.version.clone();
meta.main_skill_name.clone_from(&this.main_skill_name);
meta.version.clone_from(&this.version);
meta.last_modified = Some(self.last_modified);
}
}
Expand All @@ -114,8 +114,8 @@ impl PartialMeta for &shared::model::Paste {
return;
};
meta.ascendancy_or_class = Some(this.ascendancy_or_class);
meta.main_skill_name = this.main_skill_name.clone();
meta.version = this.version.clone();
meta.main_skill_name.clone_from(&this.main_skill_name);
meta.version.clone_from(&this.version);
meta.last_modified = Some(self.last_modified);
}
}
Expand Down

0 comments on commit 55f0664

Please sign in to comment.