Skip to content

Commit b2be174

Browse files
committed
fix: format
1 parent bc5b063 commit b2be174

File tree

10 files changed

+197
-148
lines changed

10 files changed

+197
-148
lines changed

crates/pglt_cli/src/execute/process_file/workspace_file.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ impl<'ctx, 'app> WorkspaceFile<'ctx, 'app> {
3434
file.read_to_string(&mut input)
3535
.with_file_path(path.display().to_string())?;
3636

37-
let guard = FileGuard::open(ctx.workspace, OpenFileParams {
38-
path: pglt_path,
39-
version: 0,
40-
content: input.clone(),
41-
})
37+
let guard = FileGuard::open(
38+
ctx.workspace,
39+
OpenFileParams {
40+
path: pglt_path,
41+
version: 0,
42+
content: input.clone(),
43+
},
44+
)
4245
.with_file_path_and_code(path.display().to_string(), category!("internalError/fs"))?;
4346

4447
Ok(Self {
@@ -67,10 +70,10 @@ impl<'ctx, 'app> WorkspaceFile<'ctx, 'app> {
6770
self.file
6871
.set_content(new_content.as_bytes())
6972
.with_file_path(self.path.display().to_string())?;
70-
self.guard
71-
.change_file(self.file.file_version(), vec![ChangeParams::overwrite(
72-
new_content,
73-
)])?;
73+
self.guard.change_file(
74+
self.file.file_version(),
75+
vec![ChangeParams::overwrite(new_content)],
76+
)?;
7477
Ok(())
7578
}
7679
}

crates/pglt_cli/src/execute/traverse.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,23 @@ pub(crate) fn traverse(
9292

9393
// The traversal context is scoped to ensure all the channels it
9494
// contains are properly closed once the traversal finishes
95-
let (elapsed, evaluated_paths) = traverse_inputs(fs, inputs, &TraversalOptions {
95+
let (elapsed, evaluated_paths) = traverse_inputs(
9696
fs,
97-
workspace,
98-
execution,
99-
interner,
100-
matches: &matches,
101-
changed: &changed,
102-
unchanged: &unchanged,
103-
skipped: &skipped,
104-
messages: sender,
105-
remaining_diagnostics: &remaining_diagnostics,
106-
evaluated_paths: RwLock::default(),
107-
});
97+
inputs,
98+
&TraversalOptions {
99+
fs,
100+
workspace,
101+
execution,
102+
interner,
103+
matches: &matches,
104+
changed: &changed,
105+
unchanged: &unchanged,
106+
skipped: &skipped,
107+
messages: sender,
108+
remaining_diagnostics: &remaining_diagnostics,
109+
evaluated_paths: RwLock::default(),
110+
},
111+
);
108112
// wait for the main thread to finish
109113
let diagnostics = handler.join().unwrap();
110114

crates/pglt_cli/src/lib.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,18 @@ impl<'app> CliSession<'app> {
7474
staged,
7575
changed,
7676
since,
77-
} => run_command(self, &cli_options, CheckCommandPayload {
78-
configuration,
79-
paths,
80-
stdin_file_path,
81-
staged,
82-
changed,
83-
since,
84-
}),
77+
} => run_command(
78+
self,
79+
&cli_options,
80+
CheckCommandPayload {
81+
configuration,
82+
paths,
83+
stdin_file_path,
84+
staged,
85+
changed,
86+
since,
87+
},
88+
),
8589
PgltCommand::Clean => commands::clean::clean(self),
8690
PgltCommand::Start {
8791
config_path,

crates/pglt_diagnostics/src/advice.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,12 @@ where
214214
Applicability::MaybeIncorrect => "Unsafe fix",
215215
};
216216

217-
visitor.record_log(LogCategory::Info, &markup! {
218-
{applicability}": "{self.msg}
219-
})?;
217+
visitor.record_log(
218+
LogCategory::Info,
219+
&markup! {
220+
{applicability}": "{self.msg}
221+
},
222+
)?;
220223

221224
visitor.record_diff(&self.suggestion)
222225
}

crates/pglt_diagnostics/src/display.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,12 @@ where
313313

314314
// Print a log advice for the message, with a special fallback if the buffer is empty
315315
if message.is_empty() {
316-
visitor.record_log(LogCategory::None, &markup! {
317-
<Dim>"no diagnostic message provided"</Dim>
318-
})?;
316+
visitor.record_log(
317+
LogCategory::None,
318+
&markup! {
319+
<Dim>"no diagnostic message provided"</Dim>
320+
},
321+
)?;
319322
} else {
320323
let category = match diagnostic.severity() {
321324
Severity::Fatal | Severity::Error => LogCategory::Error,

crates/pglt_diagnostics/src/display/frame.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,17 @@ pub(super) fn print_frame(fmt: &mut fmt::Formatter<'_>, location: Location<'_>)
163163
})?;
164164

165165
// Show invisible characters
166-
print_invisibles(fmt, line_text, PrintInvisiblesOptions {
167-
ignore_trailing_carriage_return: true,
168-
ignore_leading_tabs: true,
169-
ignore_lone_spaces: true,
170-
at_line_start: true,
171-
at_line_end: true,
172-
})?;
166+
print_invisibles(
167+
fmt,
168+
line_text,
169+
PrintInvisiblesOptions {
170+
ignore_trailing_carriage_return: true,
171+
ignore_leading_tabs: true,
172+
ignore_lone_spaces: true,
173+
at_line_start: true,
174+
at_line_end: true,
175+
},
176+
)?;
173177

174178
fmt.write_str("\n")?;
175179

crates/pglt_lsp/src/utils.rs

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -333,34 +333,37 @@ line 7 new";
333333

334334
let text_edit = super::text_edit(&line_index, diff, PositionEncoding::Utf8, None).unwrap();
335335

336-
assert_eq!(text_edit.as_slice(), &[
337-
lsp::TextEdit {
338-
range: lsp::Range {
339-
start: lsp::Position {
340-
line: 0,
341-
character: 7,
342-
},
343-
end: lsp::Position {
344-
line: 0,
345-
character: 10,
336+
assert_eq!(
337+
text_edit.as_slice(),
338+
&[
339+
lsp::TextEdit {
340+
range: lsp::Range {
341+
start: lsp::Position {
342+
line: 0,
343+
character: 7,
344+
},
345+
end: lsp::Position {
346+
line: 0,
347+
character: 10,
348+
},
346349
},
350+
new_text: String::from("new"),
347351
},
348-
new_text: String::from("new"),
349-
},
350-
lsp::TextEdit {
351-
range: lsp::Range {
352-
start: lsp::Position {
353-
line: 6,
354-
character: 7
352+
lsp::TextEdit {
353+
range: lsp::Range {
354+
start: lsp::Position {
355+
line: 6,
356+
character: 7
357+
},
358+
end: lsp::Position {
359+
line: 6,
360+
character: 10
361+
}
355362
},
356-
end: lsp::Position {
357-
line: 6,
358-
character: 10
359-
}
363+
new_text: String::from("new"),
360364
},
361-
new_text: String::from("new"),
362-
},
363-
]);
365+
]
366+
);
364367
}
365368

366369
#[test]
@@ -373,47 +376,50 @@ line 7 new";
373376

374377
let text_edit = super::text_edit(&line_index, diff, PositionEncoding::Utf8, None).unwrap();
375378

376-
assert_eq!(text_edit.as_slice(), &[
377-
lsp::TextEdit {
378-
range: lsp::Range {
379-
start: lsp::Position {
380-
line: 0,
381-
character: 12,
382-
},
383-
end: lsp::Position {
384-
line: 0,
385-
character: 13,
379+
assert_eq!(
380+
text_edit.as_slice(),
381+
&[
382+
lsp::TextEdit {
383+
range: lsp::Range {
384+
start: lsp::Position {
385+
line: 0,
386+
character: 12,
387+
},
388+
end: lsp::Position {
389+
line: 0,
390+
character: 13,
391+
},
386392
},
393+
new_text: String::from("`"),
387394
},
388-
new_text: String::from("`"),
389-
},
390-
lsp::TextEdit {
391-
range: lsp::Range {
392-
start: lsp::Position {
393-
line: 0,
394-
character: 23
395+
lsp::TextEdit {
396+
range: lsp::Range {
397+
start: lsp::Position {
398+
line: 0,
399+
character: 23
400+
},
401+
end: lsp::Position {
402+
line: 0,
403+
character: 27
404+
}
395405
},
396-
end: lsp::Position {
397-
line: 0,
398-
character: 27
399-
}
406+
new_text: String::from("${"),
400407
},
401-
new_text: String::from("${"),
402-
},
403-
lsp::TextEdit {
404-
range: lsp::Range {
405-
start: lsp::Position {
406-
line: 0,
407-
character: 35
408+
lsp::TextEdit {
409+
range: lsp::Range {
410+
start: lsp::Position {
411+
line: 0,
412+
character: 35
413+
},
414+
end: lsp::Position {
415+
line: 0,
416+
character: 35
417+
}
408418
},
409-
end: lsp::Position {
410-
line: 0,
411-
character: 35
412-
}
419+
new_text: String::from("}`"),
413420
},
414-
new_text: String::from("}`"),
415-
},
416-
]);
421+
]
422+
);
417423
}
418424

419425
// #[test]

0 commit comments

Comments
 (0)