Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: don't use debug format to print source errors #2618

Merged
merged 1 commit into from
Nov 23, 2023
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
8 changes: 4 additions & 4 deletions cli/src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl TracingSubscription {
.from_env_lossy()
})
.map_err(|err| {
CommandError::InternalError(format!("failed to enable verbose logging: {err:?}"))
CommandError::InternalError(format!("failed to enable verbose logging: {err}"))
})?;
tracing::info!("verbose logging enabled");
Ok(())
Expand Down Expand Up @@ -2215,14 +2215,14 @@ pub fn write_config_value_to_file(
// If config doesn't exist yet, read as empty and we'll write one.
std::io::ErrorKind::NotFound => Ok("".to_string()),
_ => Err(user_error(format!(
"Failed to read file {path}: {err:?}",
"Failed to read file {path}: {err}",
path = path.display()
))),
}
})?;
let mut doc = toml_edit::Document::from_str(&config_toml).map_err(|err| {
user_error(format!(
"Failed to parse file {path}: {err:?}",
"Failed to parse file {path}: {err}",
path = path.display()
))
})?;
Expand Down Expand Up @@ -2264,7 +2264,7 @@ pub fn write_config_value_to_file(
// Write config back
std::fs::write(path, doc.to_string()).map_err(|err| {
user_error(format!(
"Failed to write file {path}: {err:?}",
"Failed to write file {path}: {err}",
path = path.display()
))
})
Expand Down
2 changes: 1 addition & 1 deletion cli/src/merge_tools/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum BuiltinToolError {
},
#[error("Rendering {item} {id} is unimplemented for the builtin difftool/mergetool")]
Unimplemented { item: &'static str, id: String },
#[error("Backend error: {0:?}")]
#[error("Backend error: {0}")]
BackendError(#[from] jj_lib::backend::BackendError),
}

Expand Down
4 changes: 2 additions & 2 deletions cli/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ pub enum PaginationChoice {
fn pagination_setting(config: &config::Config) -> Result<PaginationChoice, CommandError> {
config
.get::<PaginationChoice>("ui.paginate")
.map_err(|err| CommandError::ConfigError(format!("Invalid `ui.paginate`: {err:?}")))
.map_err(|err| CommandError::ConfigError(format!("Invalid `ui.paginate`: {err}")))
}

fn pager_setting(config: &config::Config) -> Result<CommandNameAndArgs, CommandError> {
config
.get::<CommandNameAndArgs>("ui.pager")
.map_err(|err| CommandError::ConfigError(format!("Invalid `ui.pager`: {err:?}")))
.map_err(|err| CommandError::ConfigError(format!("Invalid `ui.pager`: {err}")))
}

impl Ui {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/default_index_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ impl IndexStore for DefaultIndexStore {
.downcast::<MutableIndexImpl>()
.expect("index to merge in must be a MutableIndexImpl");
let index = index.save_in(self.dir.clone()).map_err(|err| {
IndexWriteError::Other(format!("Failed to write commit index file: {err:?}"))
IndexWriteError::Other(format!("Failed to write commit index file: {err}"))
})?;
self.associate_file_with_operation(&index, op_id)
.map_err(|err| {
IndexWriteError::Other(format!(
"Failed to associate commit index file with a operation {op_id:?}: {err:?}"
"Failed to associate commit index file with a operation {op_id:?}: {err}"
))
})?;
Ok(Box::new(ReadonlyIndexWrapper(index)))
Expand Down
8 changes: 4 additions & 4 deletions lib/src/working_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub enum SnapshotError {
max_size: HumanByteSize,
},
/// Some other error happened while snapshotting the working copy.
#[error("{message}: {err:?}")]
#[error("{message}: {err}")]
Other {
/// Error message.
message: String,
Expand Down Expand Up @@ -224,7 +224,7 @@ pub enum CheckoutError {
#[error("Internal backend error: {0}")]
InternalBackendError(#[from] BackendError),
/// Some other error happened while checking out the working copy.
#[error("{message}: {err:?}")]
#[error("{message}: {err}")]
Other {
/// Error message.
message: String,
Expand All @@ -248,7 +248,7 @@ pub enum ResetError {
#[error("Internal error: {0}")]
InternalBackendError(#[from] BackendError),
/// Some other error happened while checking out the working copy.
#[error("{message}: {err:?}")]
#[error("{message}: {err}")]
Other {
/// Error message.
message: String,
Expand All @@ -260,7 +260,7 @@ pub enum ResetError {

/// An error while reading the working copy state.
#[derive(Debug, Error)]
#[error("{message}: {err:?}")]
#[error("{message}: {err}")]
pub struct WorkingCopyStateError {
/// Error message.
pub message: String,
Expand Down