Skip to content

Commit b109f12

Browse files
author
Test User
committed
fix: cargo fmt after merge sweep
1 parent e6932f9 commit b109f12

4 files changed

Lines changed: 65 additions & 21 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/terraphim_lsp/src/server.rs

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,32 @@ mod tests {
291291
#[test]
292292
fn position_to_byte_offset_single_line() {
293293
let text = "hello world";
294-
let pos = Position { line: 0, character: 6 };
294+
let pos = Position {
295+
line: 0,
296+
character: 6,
297+
};
295298
assert_eq!(position_to_byte_offset(text, pos), 6);
296299
}
297300

298301
#[test]
299302
fn position_to_byte_offset_multiline() {
300303
let text = "line one\nline two\nline three";
301304
// character 5 on line 1 → byte offset 9 (line one\n) + 5 = 14
302-
let pos = Position { line: 1, character: 5 };
305+
let pos = Position {
306+
line: 1,
307+
character: 5,
308+
};
303309
assert_eq!(position_to_byte_offset(text, pos), 14);
304310
}
305311

306312
#[test]
307313
fn position_to_byte_offset_clamps_to_line_length() {
308314
let text = "abc\ndef";
309315
// character 100 on line 0 → clamped to line length 3
310-
let pos = Position { line: 0, character: 100 };
316+
let pos = Position {
317+
line: 0,
318+
character: 100,
319+
};
311320
assert_eq!(position_to_byte_offset(text, pos), 3);
312321
}
313322

@@ -316,38 +325,77 @@ mod tests {
316325
let text = "only one line";
317326
// line 5 does not exist; the loop adds +1 per line for a phantom newline,
318327
// so the returned offset is text.len() + 1.
319-
let pos = Position { line: 5, character: 0 };
328+
let pos = Position {
329+
line: 5,
330+
character: 0,
331+
};
320332
assert_eq!(position_to_byte_offset(text, pos), text.len() + 1);
321333
}
322334

323335
#[test]
324336
fn byte_offset_to_position_first_char() {
325337
let pos = byte_offset_to_position("hello", 0);
326-
assert_eq!(pos, Position { line: 0, character: 0 });
338+
assert_eq!(
339+
pos,
340+
Position {
341+
line: 0,
342+
character: 0
343+
}
344+
);
327345
}
328346

329347
#[test]
330348
fn byte_offset_to_position_second_line() {
331349
let text = "abc\nxyz";
332350
// byte offset 4 → first char of second line
333351
let pos = byte_offset_to_position(text, 4);
334-
assert_eq!(pos, Position { line: 1, character: 0 });
352+
assert_eq!(
353+
pos,
354+
Position {
355+
line: 1,
356+
character: 0
357+
}
358+
);
335359
}
336360

337361
#[test]
338362
fn byte_range_to_lsp_range_same_line() {
339363
let text = "hello world";
340364
let range = byte_range_to_lsp_range(text, 6, 11);
341-
assert_eq!(range.start, Position { line: 0, character: 6 });
342-
assert_eq!(range.end, Position { line: 0, character: 11 });
365+
assert_eq!(
366+
range.start,
367+
Position {
368+
line: 0,
369+
character: 6
370+
}
371+
);
372+
assert_eq!(
373+
range.end,
374+
Position {
375+
line: 0,
376+
character: 11
377+
}
378+
);
343379
}
344380

345381
#[test]
346382
fn byte_range_to_lsp_range_cross_line() {
347383
let text = "foo\nbar";
348384
// byte 0..7 spans both lines
349385
let range = byte_range_to_lsp_range(text, 0, 7);
350-
assert_eq!(range.start, Position { line: 0, character: 0 });
351-
assert_eq!(range.end, Position { line: 1, character: 3 });
386+
assert_eq!(
387+
range.start,
388+
Position {
389+
line: 0,
390+
character: 0
391+
}
392+
);
393+
assert_eq!(
394+
range.end,
395+
Position {
396+
line: 1,
397+
character: 3
398+
}
399+
);
352400
}
353401
}

crates/terraphim_rlm/src/rlm.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,13 +940,15 @@ impl TerraphimRlm {
940940
}
941941
let stdin_is_tty = atty::is(atty::Stream::Stdin);
942942
let stderr_is_tty = atty::is(atty::Stream::Stderr);
943-
let has_display = std::env::var("DISPLAY").is_ok()
944-
|| std::env::var("WAYLAND_DISPLAY").is_ok();
943+
let has_display =
944+
std::env::var("DISPLAY").is_ok() || std::env::var("WAYLAND_DISPLAY").is_ok();
945945
if (!stdin_is_tty || !stderr_is_tty) && !has_display {
946946
log::debug!(
947947
"RLM auto-configure: skipping 1Password (no tty, no display): \
948948
stdin_tty={}, stderr_tty={}, has_display={}",
949-
stdin_is_tty, stderr_is_tty, has_display
949+
stdin_is_tty,
950+
stderr_is_tty,
951+
has_display
950952
);
951953
return None;
952954
}

crates/terraphim_workspace/src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,7 @@ mod tests {
589589

590590
// A sibling path that shares the root's string prefix but is NOT a child.
591591
// e.g. root = /tmp/abc → sibling = /tmp/abc-evil/payload
592-
let root_name = tmp
593-
.path()
594-
.file_name()
595-
.unwrap()
596-
.to_str()
597-
.unwrap()
598-
.to_owned();
592+
let root_name = tmp.path().file_name().unwrap().to_str().unwrap().to_owned();
599593
let sibling = tmp
600594
.path()
601595
.parent()

0 commit comments

Comments
 (0)