Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
allow-mixed-uninlined-format-args = false
allow-unwrap-in-tests = true
11 changes: 5 additions & 6 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -894,10 +894,9 @@ impl<'a> AuthenticatedApi<'a> {
};
self.put(
&format!(
"/projects/{}/{}/issues/?{}",
"/projects/{}/{}/issues/?{qs}",
PathArg(org),
PathArg(project),
qs
PathArg(project)
),
changes,
)?
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/debug_files/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/commands/debug_files/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/files/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
5 changes: 2 additions & 3 deletions src/commands/monitors/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@ fn run_program(args: Vec<&String>, monitor_slug: &str) -> (bool, Option<i32>, 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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/react_native/appcenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/react_native/xcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/send_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
Expand Down
14 changes: 5 additions & 9 deletions src/commands/sourcemaps/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,14 @@ fn process_sources_from_bundle(

let bundle_path = PathBuf::from(matches.get_one::<String>("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::<String>("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());
Expand Down Expand Up @@ -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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/utils/appcenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}

Expand Down Expand Up @@ -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
));
}
}
Expand All @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/chunks/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down
3 changes: 1 addition & 2 deletions src/utils/dif_upload/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -300,7 +300,6 @@ impl Display for DifMatch<'_> {
}
})
.unwrap_or_default(),
kind,
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/file_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ fn url_to_bundle_path(url: &str) -> Result<String> {

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()),
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/mobile_app/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(">");
Expand Down
10 changes: 4 additions & 6 deletions src/utils/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!();
Expand Down Expand Up @@ -146,23 +146,21 @@ 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())
);
}

/// 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())
)
}

Expand Down