diff --git a/sentry-core/Cargo.toml b/sentry-core/Cargo.toml index 59c2200c..c3c3a809 100644 --- a/sentry-core/Cargo.toml +++ b/sentry-core/Cargo.toml @@ -38,5 +38,4 @@ log_ = { package = "log", version = "0.4.8", optional = true, features = ["std"] sentry = { version = "0.21.0", path = "../sentry", default-features = false, features = ["test"] } thiserror = "1.0.15" anyhow = "1.0.30" -failure = "0.1.8" tokio = { version = "0.2", features = ["rt-core", "macros"] } diff --git a/sentry-core/src/error.rs b/sentry-core/src/error.rs index 980d09ad..4ee16db1 100644 --- a/sentry-core/src/error.rs +++ b/sentry-core/src/error.rs @@ -145,11 +145,4 @@ fn test_parse_type_from_debug() { anyhow::Error::from("NaN".parse::().unwrap_err()) ); assert_eq!(parse(&err), "ParseIntError"); - - // `failure` is using normal debug formatting - let err = format!( - "{:?}", - failure::Error::from("NaN".parse::().unwrap_err()) - ); - assert_eq!(parse(&err), "ParseIntError"); } diff --git a/sentry-core/src/scope/real.rs b/sentry-core/src/scope/real.rs index 3080f91c..23df110e 100644 --- a/sentry-core/src/scope/real.rs +++ b/sentry-core/src/scope/real.rs @@ -34,8 +34,8 @@ pub type EventProcessor = Box) -> Option> + #[derive(Clone)] pub struct Scope { pub(crate) level: Option, - pub(crate) fingerprint: Option>>>, - pub(crate) transaction: Option>, + pub(crate) fingerprint: Option]>>, + pub(crate) transaction: Option>, pub(crate) breadcrumbs: im::Vector, pub(crate) user: Option>, pub(crate) extra: im::HashMap, @@ -167,13 +167,13 @@ impl Scope { /// Sets the fingerprint. pub fn set_fingerprint(&mut self, fingerprint: Option<&[&str]>) { - self.fingerprint = fingerprint - .map(|fp| Arc::new(fp.iter().map(|x| Cow::Owned((*x).to_string())).collect())) + self.fingerprint = + fingerprint.map(|fp| fp.iter().map(|s| Cow::Owned((*s).into())).collect()) } /// Sets the transaction. pub fn set_transaction(&mut self, transaction: Option<&str>) { - self.transaction = transaction.map(|txn| Arc::new(txn.to_string())); + self.transaction = transaction.map(Arc::from); } /// Sets the user for the current scope. @@ -231,8 +231,8 @@ impl Scope { } if event.user.is_none() { - if let Some(ref user) = self.user { - event.user = Some((**user).clone()); + if let Some(user) = self.user.as_deref() { + event.user = Some(user.clone()); } } @@ -244,16 +244,16 @@ impl Scope { event.contexts.extend(self.contexts.clone().into_iter()); if event.transaction.is_none() { - if let Some(ref txn) = self.transaction { - event.transaction = Some((**txn).clone()); + if let Some(txn) = self.transaction.as_deref() { + event.transaction = Some(txn.to_owned()); } } if event.fingerprint.len() == 1 && (event.fingerprint[0] == "{{ default }}" || event.fingerprint[0] == "{{default}}") { - if let Some(ref fp) = self.fingerprint { - event.fingerprint = Cow::Owned((**fp).clone()); + if let Some(fp) = self.fingerprint.as_deref() { + event.fingerprint = Cow::Owned(fp.to_owned()); } } diff --git a/sentry-types/src/dsn.rs b/sentry-types/src/dsn.rs index 16167a40..e67aa5e5 100644 --- a/sentry-types/src/dsn.rs +++ b/sentry-types/src/dsn.rs @@ -174,7 +174,7 @@ impl FromStr for Dsn { let project_id = path_segments .next() - .ok_or_else(|| ParseDsnError::NoProjectId)? + .ok_or(ParseDsnError::NoProjectId)? .parse() .map_err(ParseDsnError::InvalidProjectId)?; let path = match path_segments.next().unwrap_or("") { diff --git a/sentry/src/defaults.rs b/sentry/src/defaults.rs index c58bd18d..0a8fbaca 100644 --- a/sentry/src/defaults.rs +++ b/sentry/src/defaults.rs @@ -1,6 +1,3 @@ -#![cfg_attr(feature = "error-chain", allow(deprecated))] -#![cfg_attr(feature = "failure", allow(deprecated))] - use std::env; use std::{borrow::Cow, sync::Arc}; diff --git a/sentry/src/lib.rs b/sentry/src/lib.rs index 534144f6..cdf56b6b 100644 --- a/sentry/src/lib.rs +++ b/sentry/src/lib.rs @@ -56,8 +56,6 @@ //! //! * `anyhow`: Enables support for the `anyhow` crate. //! * `debug-images`: Attaches a list of loaded libraries to events (currently only supported on unix). -//! * `error-chain`: Enables support for the `error-chain` crate. -//! * `failure`: Enables support for the `failure` crate. //! * `log`: Enables support for the `log` crate. //! * `env_logger`: Enables support for the `log` crate with additional `env_logger` support. //! * `slog`: Enables support for the `slog` crate.