From 463093bc126c368ed8985ed8a8446bd55f2be4e1 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Mon, 28 Aug 2023 14:11:17 +0200 Subject: [PATCH] Apply clippy fixes and cherry-pick PRs (#610) - Bump webpki-roots to ^0.25.1 - `debug-images` should be listed as a default feature - Apply clippy suggestions and bump MSRV --------- Co-authored-by: Marcus Pettersen Irgens Co-authored-by: Tim Fish --- .github/workflows/ci.yml | 2 +- README.md | 4 ++-- clippy.toml | 2 +- sentry-actix/Cargo.toml | 2 +- sentry-anyhow/Cargo.toml | 2 +- sentry-backtrace/Cargo.toml | 2 +- sentry-backtrace/src/utils.rs | 12 ++++++------ sentry-contexts/Cargo.toml | 2 +- sentry-core/Cargo.toml | 2 +- sentry-debug-images/Cargo.toml | 2 +- sentry-log/Cargo.toml | 2 +- sentry-panic/Cargo.toml | 2 +- sentry-slog/Cargo.toml | 2 +- sentry-tower/Cargo.toml | 2 +- sentry-tracing/Cargo.toml | 2 +- sentry-types/Cargo.toml | 2 +- sentry-types/tests/test_auth.rs | 4 ++-- sentry/Cargo.toml | 4 ++-- sentry/README.md | 4 ++-- sentry/src/defaults.rs | 2 +- sentry/src/lib.rs | 4 ++-- sentry/src/transports/surf.rs | 2 +- sentry/src/transports/ureq.rs | 2 +- 23 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68b8c0b3..a254af79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - rust: [1.66.0] + rust: [1.67.0] name: Check / Test MSRV on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 3404fdfd..d2191f5e 100644 --- a/README.md +++ b/README.md @@ -93,12 +93,12 @@ best API and adding new features. We currently only verify this crate against a recent version of Sentry hosted on [sentry.io](https://sentry.io/) but it should work with on-prem Sentry versions 20.6 and later. -The **Minimum Supported Rust Version** is currently at _1.66.0_. +The **Minimum Supported Rust Version** is currently at _1.67.0_. The Sentry crates will support a _6 months_ old Rust version at time of release, and the MSRV will be increased in accordance with its dependencies. **Note**: Due to the misconfiguration in our workflow that verified the MSRV builds, -we had to bump it all the way to _1.66.0_, breaking our own _6 months_ old rule. +we had to bump it all the way to _1.67.0_, breaking our own _6 months_ old rule. As of version _0.30.0_, the workflow has been fixed, and the MSRV will be enforced correctly. ## Resources diff --git a/clippy.toml b/clippy.toml index e90d7e34..91884d3a 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.66.0" +msrv = "1.67.0" diff --git a/sentry-actix/Cargo.toml b/sentry-actix/Cargo.toml index c491e86f..bfe2bb55 100644 --- a/sentry-actix/Cargo.toml +++ b/sentry-actix/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry client extension for actix-web 3. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] actix-web = { version = "4", default-features = false } diff --git a/sentry-anyhow/Cargo.toml b/sentry-anyhow/Cargo.toml index b61e30e0..9592d218 100644 --- a/sentry-anyhow/Cargo.toml +++ b/sentry-anyhow/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for anyhow. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [features] default = ["backtrace"] diff --git a/sentry-backtrace/Cargo.toml b/sentry-backtrace/Cargo.toml index 614a8ca4..cc6f78cf 100644 --- a/sentry-backtrace/Cargo.toml +++ b/sentry-backtrace/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration and utilities for dealing with stacktraces. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] backtrace = "0.3.44" diff --git a/sentry-backtrace/src/utils.rs b/sentry-backtrace/src/utils.rs index 3822f652..6b018ff5 100644 --- a/sentry-backtrace/src/utils.rs +++ b/sentry-backtrace/src/utils.rs @@ -14,34 +14,34 @@ static HASH_FUNC_RE: Lazy = Lazy::new(|| { static CRATE_HASH_RE: Lazy = Lazy::new(|| { Regex::new( - r#"(?x) + r"(?x) \b(\[[a-f0-9]{16}\]) - "#, + ", ) .unwrap() }); static CRATE_RE: Lazy = Lazy::new(|| { Regex::new( - r#"(?x) + r"(?x) ^ (?:_?<)? # trait impl syntax (?:\w+\ as \ )? # anonymous implementor ([a-zA-Z0-9_]+?) # crate name (?:\.\.|::|\[) # crate delimiter (.. or :: or [) - "#, + ", ) .unwrap() }); static COMMON_RUST_SYMBOL_ESCAPES_RE: Lazy = Lazy::new(|| { Regex::new( - r#"(?x) + r"(?x) \$ (SP|BP|RF|LT|GT|LP|RP|C| u7e|u20|u27|u5b|u5d|u7b|u7d|u3b|u2b|u22) \$ - "#, + ", ) .unwrap() }); diff --git a/sentry-contexts/Cargo.toml b/sentry-contexts/Cargo.toml index 1c996614..f8bc819a 100644 --- a/sentry-contexts/Cargo.toml +++ b/sentry-contexts/Cargo.toml @@ -11,7 +11,7 @@ Sentry integration for os, device, and rust contexts. """ build = "build.rs" edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] sentry-core = { version = "0.31.5", path = "../sentry-core" } diff --git a/sentry-core/Cargo.toml b/sentry-core/Cargo.toml index bae4d4ad..9de2bece 100644 --- a/sentry-core/Cargo.toml +++ b/sentry-core/Cargo.toml @@ -10,7 +10,7 @@ description = """ Core sentry library used for instrumentation and integration development. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [package.metadata.docs.rs] all-features = true diff --git a/sentry-debug-images/Cargo.toml b/sentry-debug-images/Cargo.toml index 764cf54a..00eddd3f 100644 --- a/sentry-debug-images/Cargo.toml +++ b/sentry-debug-images/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration that adds the list of loaded libraries to events. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] findshlibs = "=0.10.2" diff --git a/sentry-log/Cargo.toml b/sentry-log/Cargo.toml index 6c01947c..5d3b2623 100644 --- a/sentry-log/Cargo.toml +++ b/sentry-log/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for log and env_logger crates. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] sentry-core = { version = "0.31.5", path = "../sentry-core" } diff --git a/sentry-panic/Cargo.toml b/sentry-panic/Cargo.toml index 23c71311..2a858b9f 100644 --- a/sentry-panic/Cargo.toml +++ b/sentry-panic/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for capturing panics. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] sentry-core = { version = "0.31.5", path = "../sentry-core" } diff --git a/sentry-slog/Cargo.toml b/sentry-slog/Cargo.toml index 9e511667..8f8e2d8a 100644 --- a/sentry-slog/Cargo.toml +++ b/sentry-slog/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for the slog crate. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [dependencies] sentry-core = { version = "0.31.5", path = "../sentry-core" } diff --git a/sentry-tower/Cargo.toml b/sentry-tower/Cargo.toml index b920a7d5..50b2c6a9 100644 --- a/sentry-tower/Cargo.toml +++ b/sentry-tower/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for tower-based crates. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [features] http = ["dep:http", "pin-project", "url"] diff --git a/sentry-tracing/Cargo.toml b/sentry-tracing/Cargo.toml index 37c2fcf1..e13df9d6 100644 --- a/sentry-tracing/Cargo.toml +++ b/sentry-tracing/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry integration for tracing and tracing-subscriber crates. """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [features] default = [] diff --git a/sentry-types/Cargo.toml b/sentry-types/Cargo.toml index 8e252d6f..b21b4815 100644 --- a/sentry-types/Cargo.toml +++ b/sentry-types/Cargo.toml @@ -11,7 +11,7 @@ Common reusable types for implementing the sentry.io protocol. """ keywords = ["sentry", "protocol"] edition = "2021" -rust-version = "1.66" +rust-version = "1.67" [package.metadata.docs.rs] all-features = true diff --git a/sentry-types/tests/test_auth.rs b/sentry-types/tests/test_auth.rs index ae6eae5b..f7b54cf7 100644 --- a/sentry-types/tests/test_auth.rs +++ b/sentry-types/tests/test_auth.rs @@ -53,7 +53,7 @@ fn test_auth_from_iterator() { cont.insert("sentry_client", "raven-js/3.23.3"); cont.insert("sentry_key", "4bb5d94de752a36b8b87851a3f82726a"); - let auth = Auth::from_pairs(cont.into_iter()).unwrap(); + let auth = Auth::from_pairs(cont).unwrap(); assert_eq!(auth.timestamp(), None); assert_eq!(auth.client_agent(), Some("raven-js/3.23.3")); assert_eq!(auth.version(), 7); @@ -90,7 +90,7 @@ fn test_auth_to_json() { cont.insert("sentry_client", "raven-js/3.23.3"); cont.insert("sentry_key", "4bb5d94de752a36b8b87851a3f82726a"); - let auth = Auth::from_pairs(cont.into_iter()).unwrap(); + let auth = Auth::from_pairs(cont).unwrap(); assert_eq!( serde_json::to_string(&auth).expect("could not serialize").as_str(), "{\"sentry_client\":\"raven-js/3.23.3\",\"sentry_version\":7,\"sentry_key\":\"4bb5d94de752a36b8b87851a3f82726a\",\"sentry_secret\":null}" diff --git a/sentry/Cargo.toml b/sentry/Cargo.toml index 6d6de6f9..fa600645 100644 --- a/sentry/Cargo.toml +++ b/sentry/Cargo.toml @@ -10,7 +10,7 @@ description = """ Sentry (getsentry.com) client for rust ;) """ edition = "2021" -rust-version = "1.66" +rust-version = "1.67" autoexamples = true # To build locally: @@ -73,7 +73,7 @@ tokio = { version = "1.0", features = ["rt"], optional = true } ureq = { version = "2.7.0", optional = true, default-features = false } native-tls = { version = "0.2.8", optional = true } rustls = { version = "0.21.2", optional = true, features = ["dangerous_configuration"] } -webpki-roots = { version = "0.23.0", optional = true } +webpki-roots = { version = "0.25.1", optional = true } [dev-dependencies] sentry-anyhow = { path = "../sentry-anyhow" } diff --git a/sentry/README.md b/sentry/README.md index 3898392c..220f9fdd 100644 --- a/sentry/README.md +++ b/sentry/README.md @@ -73,7 +73,7 @@ extra setup to function properly. | `transport` | ✅ | | | | | `anyhow` | | 🔌 | | | | `test` | | | | | -| `debug-images` | | 🔌 | | | +| `debug-images` | ✅ | 🔌 | | | | `log` | | 🔌 | | Requires extra setup; See [`sentry-log`]'s documentation. | | `debug-logs` | | | ❗ | Requires extra setup; See [`sentry-log`]'s documentation. | | `slog` | | 🔌 | | Requires extra setup; See [`sentry-slog`]'s documentation. | @@ -95,11 +95,11 @@ extra setup to function properly. - `contexts`: Enables capturing device, OS, and Rust contexts. - `panic`: Enables support for capturing panics. - `transport`: Enables the default transport, which is currently `reqwest` with `native-tls`. +- `debug-images`: Enables capturing metadata about the loaded shared libraries. ### Debugging/Testing - `anyhow`: Enables support for the `anyhow` crate. - `test`: Enables testing support. -- `debug-images`: Attaches a list of loaded libraries to events (currently only supported on Unix). ### Logging - `log`: Enables support for the `log` crate. diff --git a/sentry/src/defaults.rs b/sentry/src/defaults.rs index 4c5b5e0f..70009524 100644 --- a/sentry/src/defaults.rs +++ b/sentry/src/defaults.rs @@ -74,7 +74,7 @@ pub fn apply_defaults(mut opts: ClientOptions) -> ClientOptions { { integrations.push(Arc::new(sentry_backtrace::ProcessStacktraceIntegration)); } - integrations.extend(opts.integrations.into_iter()); + integrations.extend(opts.integrations); opts.integrations = integrations; } if opts.dsn.is_none() { diff --git a/sentry/src/lib.rs b/sentry/src/lib.rs index f9f26ecc..6652e180 100644 --- a/sentry/src/lib.rs +++ b/sentry/src/lib.rs @@ -65,7 +65,7 @@ //! | `transport` | ✅ | | | | //! | `anyhow` | | 🔌 | | | //! | `test` | | | | | -//! | `debug-images` | | 🔌 | | | +//! | `debug-images` | ✅ | 🔌 | | | //! | `log` | | 🔌 | | Requires extra setup; See [`sentry-log`]'s documentation. | //! | `debug-logs` | | | ❗ | Requires extra setup; See [`sentry-log`]'s documentation. | //! | `slog` | | 🔌 | | Requires extra setup; See [`sentry-slog`]'s documentation. | @@ -87,11 +87,11 @@ //! - `contexts`: Enables capturing device, OS, and Rust contexts. //! - `panic`: Enables support for capturing panics. //! - `transport`: Enables the default transport, which is currently `reqwest` with `native-tls`. +//! - `debug-images`: Enables capturing metadata about the loaded shared libraries. //! //! ## Debugging/Testing //! - `anyhow`: Enables support for the `anyhow` crate. //! - `test`: Enables testing support. -//! - `debug-images`: Attaches a list of loaded libraries to events (currently only supported on Unix). //! //! ## Logging //! - `log`: Enables support for the `log` crate. diff --git a/sentry/src/transports/surf.rs b/sentry/src/transports/surf.rs index 546cfae1..0a902a68 100644 --- a/sentry/src/transports/surf.rs +++ b/sentry/src/transports/surf.rs @@ -32,7 +32,7 @@ impl SurfHttpTransport { } fn new_internal(options: &ClientOptions, client: Option) -> Self { - let mut client = client.unwrap_or_else(SurfClient::new); + let mut client = client.unwrap_or_default(); if options.accept_invalid_certs { let hc = HttpClient::builder() .ssl_options(SslOption::DANGER_ACCEPT_INVALID_CERTS) diff --git a/sentry/src/transports/ureq.rs b/sentry/src/transports/ureq.rs index de5a80d9..ab4f4555 100644 --- a/sentry/src/transports/ureq.rs +++ b/sentry/src/transports/ureq.rs @@ -74,7 +74,7 @@ impl UreqHttpTransport { } let mut root_store = RootCertStore::empty(); - root_store.add_server_trust_anchors(TLS_SERVER_ROOTS.0.iter().map(|ta| { + root_store.add_trust_anchors(TLS_SERVER_ROOTS.iter().map(|ta| { OwnedTrustAnchor::from_subject_spki_name_constraints( ta.subject, ta.spki,