You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Audit error and help messages, particularly those declared with #[error("...")] and #[diagnostic(help("..."))], for those that contain calls to functions that produce String only to incorporate those strings into the main error/help message with {}. For example, in coreschema.rs, the call to pretty_print() in
#[error("context `{}` is not valid for `{action}`", pretty_print(&.context))]
or, also in coreschema.rs, the call to invalid_resource_type_help() in
These can be replaced with the new thiserror syntax #[error(fmt = some::function::call)] which does not allocate an intermediate String. And presumably some equivalent miette syntax for the diagnostic(help()) case.
This issue is low priority because performance improvements on the error path are low priority, and this code only runs when an error has occurred. It's not even clear that these are the most important performance improvements to be had on the error path. However, they may be reasonably low-hanging fruit.
Describe alternatives you've considered
The status quo is acceptable, particularly because performance improvements on the error path are low priority.
Additional context
No response
Is this something that you'd be interested in working on?
👋 I may be able to implement this internal improvement
⚠️ This feature might incur a breaking change
The text was updated successfully, but these errors were encountered:
(_unbound,0) => write!(fmt,"the following slots were not provided as arguments: {}", unbound_values.iter().join(",")),
(0, _extra) => write!(fmt,"the following slots were provided as arguments, but did not exist in the template: {}", extra_values.iter().join(",")),
(_unbound, _extra) => write!(fmt,"the following slots were not provided as arguments: {}. The following slots were provided as arguments, but did not exist in the template: {}", unbound_values.iter().join(","), extra_values.iter().join(",")),
Describe the improvement you'd like to request
Audit error and help messages, particularly those declared with
#[error("...")]
and#[diagnostic(help("..."))]
, for those that contain calls to functions that produceString
only to incorporate those strings into the main error/help message with{}
. For example, in coreschema.rs, the call topretty_print()
inor, also in coreschema.rs, the call to
invalid_resource_type_help()
inThese can be replaced with the new thiserror syntax
#[error(fmt = some::function::call)]
which does not allocate an intermediateString
. And presumably some equivalentmiette
syntax for thediagnostic(help())
case.This issue is low priority because performance improvements on the error path are low priority, and this code only runs when an error has occurred. It's not even clear that these are the most important performance improvements to be had on the error path. However, they may be reasonably low-hanging fruit.
Describe alternatives you've considered
The status quo is acceptable, particularly because performance improvements on the error path are low priority.
Additional context
No response
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: