Skip to content

Commit d684b01

Browse files
committed
sentry: Use default() to initialize ClientOptions instead of mut
1 parent 84495e3 commit d684b01

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/sentry.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ pub fn init() -> Option<ClientInitGuard> {
1616
.into_dsn()
1717
.expect("SENTRY_DSN_API is not a valid Sentry DSN value")
1818
.map(|dsn| {
19-
let mut opts = ClientOptions::from(dsn);
20-
opts.environment = Some(
19+
let environment = Some(
2120
dotenv::var("SENTRY_ENV_API")
2221
.map(Cow::Owned)
2322
.expect("SENTRY_ENV_API must be set when using SENTRY_DSN_API"),
2423
);
2524

26-
opts.release = dotenv::var("HEROKU_SLUG_COMMIT").ok().map(Into::into);
25+
let release = dotenv::var("HEROKU_SLUG_COMMIT").ok().map(Into::into);
26+
27+
let opts = ClientOptions {
28+
dsn: Some(dsn),
29+
environment,
30+
release,
31+
..Default::default()
32+
};
2733

2834
sentry::init(opts)
2935
})

0 commit comments

Comments
 (0)