chore: Fix several style lints (#17488)

It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-09-06 11:58:39 +02:00 committed by GitHub
parent 93249fc82b
commit e6c1c51b37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
361 changed files with 3530 additions and 3587 deletions

View file

@ -174,7 +174,7 @@ impl TaskTemplate {
&mut substituted_variables,
)?;
let task_hash = to_hex_hash(&self)
let task_hash = to_hex_hash(self)
.context("hashing task template")
.log_err()?;
let variables_hash = to_hex_hash(&task_variables)
@ -319,13 +319,13 @@ fn substitute_all_template_variables_in_map(
let mut new_map: HashMap<String, String> = Default::default();
for (key, value) in keys_and_values {
let new_value = substitute_all_template_variables_in_str(
&value,
value,
task_variables,
variable_names,
substituted_variables,
)?;
let new_key = substitute_all_template_variables_in_str(
&key,
key,
task_variables,
variable_names,
substituted_variables,

View file

@ -67,7 +67,7 @@ impl EnvVariableReplacer {
// Got a VSCode->Zed hit, perform a substitution
let mut name = format!("${{{substitution}");
append_previous_default(&mut name);
name.push_str("}");
name.push('}');
return Some(name);
}
// This is an unknown variable.
@ -84,7 +84,7 @@ impl EnvVariableReplacer {
}
impl VsCodeTaskDefinition {
fn to_zed_format(self, replacer: &EnvVariableReplacer) -> anyhow::Result<TaskTemplate> {
fn into_zed_format(self, replacer: &EnvVariableReplacer) -> anyhow::Result<TaskTemplate> {
if self.other_attributes.contains_key("dependsOn") {
bail!("Encountered unsupported `dependsOn` key during deserialization");
}
@ -143,7 +143,7 @@ impl TryFrom<VsCodeTaskFile> for TaskTemplates {
let templates = value
.tasks
.into_iter()
.filter_map(|vscode_definition| vscode_definition.to_zed_format(&replacer).log_err())
.filter_map(|vscode_definition| vscode_definition.into_zed_format(&replacer).log_err())
.collect();
Ok(Self(templates))
}
@ -200,9 +200,9 @@ mod tests {
#[test]
fn can_deserialize_ts_tasks() {
static TYPESCRIPT_TASKS: &'static str = include_str!("../test_data/typescript.json");
static TYPESCRIPT_TASKS: &str = include_str!("../test_data/typescript.json");
let vscode_definitions: VsCodeTaskFile =
serde_json_lenient::from_str(&TYPESCRIPT_TASKS).unwrap();
serde_json_lenient::from_str(TYPESCRIPT_TASKS).unwrap();
let expected = vec![
VsCodeTaskDefinition {
@ -290,9 +290,9 @@ mod tests {
#[test]
fn can_deserialize_rust_analyzer_tasks() {
static RUST_ANALYZER_TASKS: &'static str = include_str!("../test_data/rust-analyzer.json");
static RUST_ANALYZER_TASKS: &str = include_str!("../test_data/rust-analyzer.json");
let vscode_definitions: VsCodeTaskFile =
serde_json_lenient::from_str(&RUST_ANALYZER_TASKS).unwrap();
serde_json_lenient::from_str(RUST_ANALYZER_TASKS).unwrap();
let expected = vec![
VsCodeTaskDefinition {
label: "Build Extension in Background".to_string(),