Skip to content

Commit 3e7eec2

Browse files
authored
fix: Lint (#547)
1 parent 616587b commit 3e7eec2

File tree

20 files changed

+41
-45
lines changed

20 files changed

+41
-45
lines changed

sentry-actix/examples/basic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> io::Result<()> {
3939
runtime.block_on(async move {
4040
let addr = "127.0.0.1:3001";
4141

42-
println!("Starting server on http://{}", addr);
42+
println!("Starting server on http://{addr}");
4343

4444
HttpServer::new(|| {
4545
App::new()

sentry-anyhow/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn event_from_error(err: &anyhow::Error) -> Event<'static> {
7272
// exception records are sorted in reverse
7373
if let Some(exc) = event.exception.iter_mut().last() {
7474
let backtrace = err.backtrace();
75-
exc.stacktrace = sentry_backtrace::parse_stacktrace(&format!("{:#}", backtrace));
75+
exc.stacktrace = sentry_backtrace::parse_stacktrace(&format!("{backtrace:#}"));
7676
}
7777
}
7878

sentry-contexts/build.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
f,
2727
"pub const RUSTC_VERSION: Option<&'static str> = {};",
2828
if let Ok(version) = version() {
29-
format!("Some(\"{}\")", version)
29+
format!("Some(\"{version}\")")
3030
} else {
3131
"None".into()
3232
}
@@ -45,7 +45,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4545
Channel::Beta => "beta",
4646
Channel::Stable => "stable",
4747
};
48-
format!("Some(\"{}\")", chan)
48+
format!("Some(\"{chan}\")")
4949
} else {
5050
"None".into()
5151
}
@@ -54,11 +54,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
5454
writeln!(f, "/// The platform identifier.")?;
5555
writeln!(
5656
f,
57-
"#[allow(unused)] pub const PLATFORM: &str = \"{}\";",
58-
platform
57+
"#[allow(unused)] pub const PLATFORM: &str = \"{platform}\";"
5958
)?;
6059
writeln!(f, "/// The CPU architecture identifier.")?;
61-
writeln!(f, "pub const ARCH: &str = \"{}\";", arch)?;
60+
writeln!(f, "pub const ARCH: &str = \"{arch}\";")?;
6261

6362
println!("cargo:rerun-if-changed=build.rs");
6463
println!("cargo:rerun-if-changed=Cargo.toml");

sentry-core/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn event_from_error<E: Error + ?Sized>(err: &E) -> Event<'static> {
9797
}
9898

9999
fn exception_from_error<E: Error + ?Sized>(err: &E) -> Exception {
100-
let dbg = format!("{:?}", err);
100+
let dbg = format!("{err:?}");
101101
let value = err.to_string();
102102

103103
// A generic `anyhow::msg` will just `Debug::fmt` the `String` that you feed
@@ -106,7 +106,7 @@ fn exception_from_error<E: Error + ?Sized>(err: &E) -> Exception {
106106
// To work around this, we check if the `Debug::fmt` of the complete error
107107
// matches its `Display::fmt`, in which case there is no type to parse and
108108
// we will just be using `Error`.
109-
let ty = if dbg == format!("{:?}", value) {
109+
let ty = if dbg == format!("{value:?}") {
110110
String::from("Error")
111111
} else {
112112
parse_type_from_debug(&dbg).to_owned()
@@ -140,7 +140,7 @@ fn test_parse_type_from_debug() {
140140
use parse_type_from_debug as parse;
141141
#[derive(Debug)]
142142
struct MyStruct;
143-
let err = format!("{:?}", MyStruct);
143+
let err = format!("{MyStruct:?}");
144144
assert_eq!(parse(&err), "MyStruct");
145145

146146
let err = format!("{:?}", "NaN".parse::<usize>().unwrap_err());

sentry-core/src/performance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ mod tests {
793793
);
794794

795795
let trace = SentryTrace(Default::default(), Default::default(), None);
796-
let parsed = parse_sentry_trace(&format!("{}", trace));
796+
let parsed = parse_sentry_trace(&trace.to_string());
797797
assert_eq!(parsed, Some(trace));
798798
}
799799

sentry-core/src/profiling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn debug_images() -> Vec<DebugImage> {
143143
.unwrap_or_else(|_| "<main>".to_string());
144144
}
145145

146-
let code_id = shlib.id().map(|id| CodeId::new(format!("{}", id)));
146+
let code_id = shlib.id().map(|id| CodeId::new(id.to_string()));
147147
let debug_name = shlib.debug_name().map(|n| n.to_string_lossy().to_string());
148148

149149
// For windows, the `virtual_memory_bias` actually returns the real
@@ -271,7 +271,7 @@ fn get_profile_from_report(
271271
.into_iter()
272272
.map(|address| -> RustFrame {
273273
RustFrame {
274-
instruction_addr: format!("{:p}", address),
274+
instruction_addr: format!("{address:p}"),
275275
}
276276
})
277277
.collect(),

sentry-debug-images/src/images.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn debug_images() -> Vec<DebugImage> {
5959
.unwrap_or_else(|_| "<main>".to_string());
6060
}
6161

62-
let code_id = shlib.id().map(|id| CodeId::new(format!("{}", id)));
62+
let code_id = shlib.id().map(|id| CodeId::new(id.to_string()));
6363
let debug_name = shlib.debug_name().map(|n| n.to_string_lossy().to_string());
6464

6565
// For windows, the `virtual_memory_bias` actually returns the real

sentry-slog/src/converters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro_rules! impl_into {
2424
}
2525
impl<'a> Serializer for MapSerializer<'a> {
2626
fn emit_arguments(&mut self, key: Key, val: &fmt::Arguments) -> slog::Result {
27-
self.0.insert(key.into(), format!("{}", val).into());
27+
self.0.insert(key.into(), val.to_string().into());
2828
Ok(())
2929
}
3030

sentry-tracing/src/converters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl Visit for FieldVisitor {
8989
}
9090

9191
fn record_debug(&mut self, field: &Field, value: &dyn std::fmt::Debug) {
92-
self.record(field, format!("{:?}", value));
92+
self.record(field, format!("{value:?}"));
9393
}
9494
}
9595

sentry-tracing/src/layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ where
174174
if target.is_empty() {
175175
op.to_string()
176176
} else {
177-
format!("{}::{}", target, op)
177+
format!("{target}::{op}")
178178
}
179179
});
180180

0 commit comments

Comments
 (0)