diff --git a/Cargo.toml b/Cargo.toml index fb15fa1663..d1c0d7ec8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,6 +98,7 @@ allow-attributes = "warn" str-to-string = "warn" string-to-string = "warn" unnecessary-wraps = "warn" +uninlined-format-args = "warn" unused-trait-names = "warn" unwrap-used = "warn" diff --git a/clippy.toml b/clippy.toml index 154626ef4e..74b5a9c259 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1,2 @@ +allow-mixed-uninlined-format-args = false allow-unwrap-in-tests = true diff --git a/src/api/mod.rs b/src/api/mod.rs index ab5882e877..e11ad680ea 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -329,7 +329,7 @@ impl Api { _ => ARCH, }; - let ref_name = format!("sentry-cli-{}-{}{}", capitalize_string(PLATFORM), arch, EXT); + let ref_name = format!("sentry-cli-{}-{arch}{EXT}", capitalize_string(PLATFORM)); info!("Looking for file named: {}", ref_name); if resp.status() == 200 { @@ -894,10 +894,9 @@ impl<'a> AuthenticatedApi<'a> { }; self.put( &format!( - "/projects/{}/{}/issues/?{}", + "/projects/{}/{}/issues/?{qs}", PathArg(org), - PathArg(project), - qs + PathArg(project) ), changes, )? @@ -1252,7 +1251,7 @@ impl<'a> AuthenticatedApi<'a> { loop { requests_no += 1; - let resp = self.get(&format!("{}cursor={}", url, QueryArg(&cursor)))?; + let resp = self.get(&format!("{url}cursor={}", QueryArg(&cursor)))?; if resp.status() == 404 || (resp.status() == 400 && !cursor.is_empty()) { if rv.is_empty() { @@ -1933,7 +1932,7 @@ fn log_headers(is_response: bool, data: &[u8]) { } else { format!("{}***", &caps[3][..std::cmp::min(caps[3].len(), 8)]) }; - format!("{}: {} {}", &caps[1], &caps[2], info) + format!("{}: {} {info}", &caps[1], &caps[2]) }); debug!("{} {}", if is_response { ">" } else { "<" }, replaced); } diff --git a/src/commands/debug_files/check.rs b/src/commands/debug_files/check.rs index 8dc9a54fe1..05c2b51ab3 100644 --- a/src/commands/debug_files/check.rs +++ b/src/commands/debug_files/check.rs @@ -101,7 +101,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { } if let Some(prob) = dif.get_problem() { - println!(" Usable: {} ({})", style("no").red(), prob); + println!(" Usable: {} ({prob})", style("no").red()); Err(QuietExit(1).into()) } else { println!(" Usable: {}", style("yes").green()); diff --git a/src/commands/debug_files/find.rs b/src/commands/debug_files/find.rs index 0afeca61a2..879ec48e8e 100644 --- a/src/commands/debug_files/find.rs +++ b/src/commands/debug_files/find.rs @@ -186,7 +186,7 @@ fn find_ids( eprintln!(); eprintln!("missing debug information files:"); for id in &remaining { - eprintln!(" {} ({})", id, id_hint(id),); + eprintln!(" {id} ({})", id_hint(id),); } } } diff --git a/src/commands/files/upload.rs b/src/commands/files/upload.rs index 63cfe377ec..30892db9bc 100644 --- a/src/commands/files/upload.rs +++ b/src/commands/files/upload.rs @@ -202,7 +202,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { .iter() .map(|source| { let local_path = source.path.strip_prefix(&source.base_path).unwrap(); - let url = format!("{}/{}{}", url_prefix, path_as_url(local_path), url_suffix); + let url = format!("{url_prefix}/{}{url_suffix}", path_as_url(local_path)); ( url.clone(), diff --git a/src/commands/monitors/run.rs b/src/commands/monitors/run.rs index 9352f56582..069aa79816 100644 --- a/src/commands/monitors/run.rs +++ b/src/commands/monitors/run.rs @@ -117,10 +117,9 @@ fn run_program(args: Vec<&String>, monitor_slug: &str) -> (bool, Option, Du Ok(status) => (status.success(), status.code()), Err(err) => { eprintln!( - "{} could not invoke program '{}': {}", + "{} could not invoke program '{}': {err}", style("error").red(), - args[0], - err + args[0] ); (false, None) } diff --git a/src/commands/react_native/appcenter.rs b/src/commands/react_native/appcenter.rs index 1e49f8627a..14c05466c4 100644 --- a/src/commands/react_native/appcenter.rs +++ b/src/commands/react_native/appcenter.rs @@ -209,8 +209,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { Some(dists) => { for dist in dists { println!( - "Uploading sourcemaps for release {} distribution {}", - &release, dist + "Uploading sourcemaps for release {} distribution {dist}", + &release ); processor.upload(&UploadContext { diff --git a/src/commands/react_native/xcode.rs b/src/commands/react_native/xcode.rs index 4e2024391d..9f47bd9bec 100644 --- a/src/commands/react_native/xcode.rs +++ b/src/commands/react_native/xcode.rs @@ -361,7 +361,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { // Successfully discovered and parsed Info.plist let dist_string = plist.build().to_owned(); let release_string = - format!("{}@{}+{}", plist.bundle_id(), plist.version(), dist_string); + format!("{}@{}+{dist_string}", plist.bundle_id(), plist.version()); info!("Parse result from Info.plist: {:?}", &plist); (Some(dist_string), Some(release_string)) } diff --git a/src/commands/send_event.rs b/src/commands/send_event.rs index bedff347fd..08a34ef4d5 100644 --- a/src/commands/send_event.rs +++ b/src/commands/send_event.rs @@ -213,7 +213,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { send_raw_event(event)? }; - println!("Event from file {} dispatched: {}", path.display(), id); + println!("Event from file {} dispatched: {id}", path.display()); } return Ok(()); diff --git a/src/commands/sourcemaps/upload.rs b/src/commands/sourcemaps/upload.rs index 7f6a48e9bb..c5bd8c956d 100644 --- a/src/commands/sourcemaps/upload.rs +++ b/src/commands/sourcemaps/upload.rs @@ -284,18 +284,14 @@ fn process_sources_from_bundle( let bundle_path = PathBuf::from(matches.get_one::("bundle").unwrap()); let bundle_url = format!( - "{}/{}{}", - url_prefix, - bundle_path.file_name().unwrap().to_string_lossy(), - url_suffix + "{url_prefix}/{}{url_suffix}", + bundle_path.file_name().unwrap().to_string_lossy() ); let sourcemap_path = PathBuf::from(matches.get_one::("bundle_sourcemap").unwrap()); let sourcemap_url = format!( - "{}/{}{}", - url_prefix, - sourcemap_path.file_name().unwrap().to_string_lossy(), - url_suffix + "{url_prefix}/{}{url_suffix}", + sourcemap_path.file_name().unwrap().to_string_lossy() ); debug!("Bundle path: {}", bundle_path.display()); @@ -397,7 +393,7 @@ fn process_sources_from_paths( for source in sources { let local_path = source.path.strip_prefix(base_path).unwrap(); - let url = format!("{}/{}{}", url_prefix, path_as_url(local_path), url_suffix); + let url = format!("{url_prefix}/{}{url_suffix}", path_as_url(local_path)); processor.add(&url, source); } } diff --git a/src/config.rs b/src/config.rs index de93076820..0cfff6b01b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -646,8 +646,7 @@ fn load_cli_config() -> Result<(PathBuf, Ini)> { let (path, mut rv) = if let Some(project_config_path) = find_project_config_file() { let file_desc = format!( - "{} file from project path ({})", - CONFIG_RC_FILE_NAME, + "{CONFIG_RC_FILE_NAME} file from project path ({})", project_config_path.display() ); let mut f = fs::File::open(&project_config_path) diff --git a/src/utils/appcenter.rs b/src/utils/appcenter.rs index 73fa880295..f4ed11b31a 100644 --- a/src/utils/appcenter.rs +++ b/src/utils/appcenter.rs @@ -160,8 +160,8 @@ pub fn get_react_native_appcenter_release( if !bundle_id_ovrr.is_empty() && !version_name_ovrr.is_empty() { return Ok(format!( - "{}@{}+codepush:{}", - bundle_id_ovrr, version_name_ovrr, package.label + "{bundle_id_ovrr}@{version_name_ovrr}+codepush:{}", + package.label )); } @@ -189,8 +189,8 @@ pub fn get_react_native_appcenter_release( version_name_ovrr }; return Ok(format!( - "{}@{}+codepush:{}", - bundle_id, version_name, package.label + "{bundle_id}@{version_name}+codepush:{}", + package.label )); } } @@ -207,7 +207,7 @@ pub fn get_react_native_appcenter_release( let vec: Vec<&str> = release_name.split('@').collect(); let bundle_id = if bundle_id_ovrr.is_empty() { vec[0] } else { bundle_id_ovrr }; let version_name = if version_name_ovrr.is_empty() { vec[1] } else { version_name_ovrr }; - return Ok(format!("{}@{}+codepush:{}", bundle_id, version_name, package.label)); + return Ok(format!("{bundle_id}@{version_name}+codepush:{}", package.label)); } else { bail!("Could not parse app id from build.gradle"); } diff --git a/src/utils/chunks/upload.rs b/src/utils/chunks/upload.rs index 42963775b9..a05c8425af 100644 --- a/src/utils/chunks/upload.rs +++ b/src/utils/chunks/upload.rs @@ -279,7 +279,7 @@ where // If we skip waiting for the server to finish processing, there // are pending entries. We only expect results that have been // uploaded in the first place, so we can skip everything else. - println!(" {:>8} {}", console::style("UPLOADED").yellow(), object); + println!(" {:>8} {object}", console::style("UPLOADED").yellow()); } // All other entries will be in the `errors` list. } diff --git a/src/utils/dif_upload/mod.rs b/src/utils/dif_upload/mod.rs index eddf356aad..43af976b33 100644 --- a/src/utils/dif_upload/mod.rs +++ b/src/utils/dif_upload/mod.rs @@ -288,7 +288,7 @@ impl Display for DifMatch<'_> { write!( f, - "{} ({}; {}{})", + "{} ({}; {}{kind})", style(self.debug_id.map(|id| id.to_string()).unwrap_or_default()).dim(), self.name, self.object() @@ -300,7 +300,6 @@ impl Display for DifMatch<'_> { } }) .unwrap_or_default(), - kind, ) } } diff --git a/src/utils/file_upload.rs b/src/utils/file_upload.rs index fadfc27572..fae8c65a07 100644 --- a/src/utils/file_upload.rs +++ b/src/utils/file_upload.rs @@ -776,8 +776,8 @@ fn url_to_bundle_path(url: &str) -> Result { Ok(match url.host_str() { Some("~") => format!("_/_/{path}"), - Some(host) => format!("{}/{}/{}", url.scheme(), host, path), - None => format!("{}/_/{}", url.scheme(), path), + Some(host) => format!("{}/{host}/{path}", url.scheme()), + None => format!("{}/_/{path}", url.scheme()), }) } diff --git a/src/utils/mobile_app/apple.rs b/src/utils/mobile_app/apple.rs index 312bdc1712..e511569900 100644 --- a/src/utils/mobile_app/apple.rs +++ b/src/utils/mobile_app/apple.rs @@ -17,7 +17,7 @@ pub fn handle_asset_catalogs(path: &Path) { let cars = find_car_files(path); for car in &cars { if let Err(e) = apple_catalog_parsing::inspect_asset_catalog(car) { - eprintln!("Failed to inspect asset catalog {}: {}", car.display(), e); + eprintln!("Failed to inspect asset catalog {}: {e}", car.display()); } } } diff --git a/src/utils/progress.rs b/src/utils/progress.rs index 2673a4dac4..d0355c618f 100644 --- a/src/utils/progress.rs +++ b/src/utils/progress.rs @@ -41,7 +41,7 @@ impl ProgressBar { pub fn finish_with_duration(&self, op: &str) { let dur = self.start.elapsed(); // We could use `dur.as_secs_f64()`, but its unnecessarily precise (micros). Millis are enough for our purpose. - let msg = format!("{} completed in {}s", op, dur.as_millis() as f64 / 1000.0); + let msg = format!("{op} completed in {}s", dur.as_millis() as f64 / 1000.0); let progress_style = ProgressStyle::default_bar().template("{prefix:.dim} {msg}"); self.inner.set_style(progress_style); self.inner.set_prefix(">"); diff --git a/src/utils/system.rs b/src/utils/system.rs index 5348fbfabd..18f2aa2cc5 100644 --- a/src/utils/system.rs +++ b/src/utils/system.rs @@ -74,7 +74,7 @@ pub fn print_error(err: &Error) { } // Debug style for error includes cause chain and backtrace (if available). - eprintln!("{} {:?}", style("error:").red(), err); + eprintln!("{} {err:?}", style("error:").red()); if Config::current_opt().is_none_or(|config| config.get_log_level() < log::LevelFilter::Info) { eprintln!(); @@ -146,11 +146,10 @@ fn panic_hook(info: &PanicHookInfo) { Please open a bug report issue at https://github.com/getsentry/sentry-cli/issues/new?template=BUG_REPORT.yml. 🐞"; eprintln!( - "{}\n\n{}\n\n{}", + "{}\n\n{PANIC_MESSAGE}\n\n{}", console::style("🔥 Internal Error in Sentry CLI 🔥") .bold() .red(), - PANIC_MESSAGE, display_technical_details(info, &Backtrace::force_capture()) ); } @@ -158,11 +157,10 @@ fn panic_hook(info: &PanicHookInfo) { /// Generates the "technical details" section of the panic message fn display_technical_details(info: &PanicHookInfo, backtrace: &Backtrace) -> String { format!( - "🔬 Technical Details 🔬\n\n{} panicked at {}:\n{}\n\nStack Backtrace:\n{}", + "🔬 Technical Details 🔬\n\n{} panicked at {}:\n{}\n\nStack Backtrace:\n{backtrace}", display_thread_details(), display_panic_location(info.location()), - display_panic_payload(info.payload()), - backtrace + display_panic_payload(info.payload()) ) }