Skip to content

Commit

Permalink
Fewer String types.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshew committed Oct 28, 2024
1 parent e97a887 commit 0656cde
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ pub struct SuppressionCommentEmitterPayload<'a, L: Language> {
/// The original range of the diagnostic where the rule was triggered
pub diagnostic_text_range: &'a TextRange,
/// Explanation for the suppression to be used with `--suppress` and `--reason`
pub suppression_reason: String,
pub suppression_reason: &'a str,
}

type SignalHandler<'a, L, Break> = &'a mut dyn FnMut(&dyn AnalyzerSignal<L>) -> ControlFlow<Break>;
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_analyze/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ pub trait Rule: RuleMeta + Sized {
ctx: &RuleContext<Self>,
text_range: &TextRange,
suppression_action: &dyn SuppressionAction<Language = RuleLanguage<Self>>,
suppression_reason: Option<String>,
suppression_reason: Option<&str>,
) -> Option<SuppressAction<RuleLanguage<Self>>>
where
Self: 'static,
Expand All @@ -902,7 +902,7 @@ pub trait Rule: RuleMeta + Sized {
mutation: &mut mutation,
token_offset: token,
diagnostic_text_range: text_range,
suppression_reason: suppression_reason.unwrap_or("<explanation>".to_string()),
suppression_reason: suppression_reason.unwrap_or("<explanation>"),
});

Some(SuppressAction {
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ where
&ctx,
&text_range,
self.suppression_action,
self.suppression_reason.clone(),
self.suppression_reason.as_deref(),
) {
let action = AnalyzerAction {
rule_name: Some((<R::Group as RuleGroup>::NAME, R::METADATA.name)),
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/suppression_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub trait SuppressionAction {
mutation: &mut BatchMutation<Self::Language>,
apply_suppression: ApplySuppression<Self::Language>,
suppression_text: &str,
suppression_reason: String,
suppression_reason: &str,
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_analyze/src/suppression_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl SuppressionAction for CssSuppressionAction {
mutation: &mut BatchMutation<Self::Language>,
apply_suppression: ApplySuppression<Self::Language>,
suppression_text: &str,
suppression_reason: String,
suppression_reason: &str,
) {
let ApplySuppression {
token_to_apply_suppression,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_graphql_analyze/src/suppression_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl SuppressionAction for GraphqlSuppressionAction {
mutation: &mut BatchMutation<Self::Language>,
apply_suppression: ApplySuppression<Self::Language>,
suppression_text: &str,
suppression_reason: String,
suppression_reason: &str,
) {
let ApplySuppression {
token_to_apply_suppression,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_js_analyze/src/suppression_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl SuppressionAction for JsSuppressionAction {
mutation: &mut BatchMutation<Self::Language>,
apply_suppression: ApplySuppression<Self::Language>,
suppression_text: &str,
suppression_reason: String,
suppression_reason: &str,
) {
let ApplySuppression {
token_to_apply_suppression,
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_js_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
_: &mut BatchMutation<Self::Language>,
_: ApplySuppression<Self::Language>,
_: &str,
_: String,
_: &str,
) {
unreachable!("")
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_json_analyze/src/suppression_action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl SuppressionAction for JsonSuppressionAction {
_mutation: &mut BatchMutation<Self::Language>,
_apply_suppression: ApplySuppression<Self::Language>,
_suppression_text: &str,
_suppression_reason: String,
_suppression_reason: &str,
) {
unreachable!("find_token_to_apply_suppression return None")
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_migrate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
_: &mut BatchMutation<Self::Language>,
_: ApplySuppression<Self::Language>,
_: &str,
_: String,
_: &str,
) {
unreachable!("")
}
Expand Down

0 comments on commit 0656cde

Please sign in to comment.