Skip to content

An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.

Rust

style: apply rustfmt formatting

clawdbot44ff1249fa12
diff --git a/rust/crates/runtime/src/file_ops.rs b/rust/crates/runtime/src/file_ops.rs
index 4bdd6ffe..696816cc 100644
--- a/rust/crates/runtime/src/file_ops.rs
+++ b/rust/crates/runtime/src/file_ops.rs
@@ -319,7 +319,7 @@ fn apply_line_selector(
// Check if it's a contiguous range
let is_contiguous = (last - first + 1) == indices.len();
-
+
if is_contiguous {
(first, last + 1, None)
} else {
@@ -1295,13 +1295,9 @@ mod tests {
)
.expect("write should succeed");
- let output = super::read_file_with_selector(
- path.to_string_lossy().as_ref(),
- None,
- None,
- Some("2"),
- )
- .expect("read with selector should succeed");
+ let output =
+ super::read_file_with_selector(path.to_string_lossy().as_ref(), None, None, Some("2"))
+ .expect("read with selector should succeed");
assert_eq!(output.file.content, "line2");
assert_eq!(output.file.start_line, 2);
assert_eq!(output.file.num_lines, 1);
@@ -1379,13 +1375,9 @@ mod tests {
)
.expect("write should succeed");
- let output = super::read_file_with_selector(
- path.to_string_lossy().as_ref(),
- None,
- None,
- None,
- )
- .expect("read with selector should succeed");
+ let output =
+ super::read_file_with_selector(path.to_string_lossy().as_ref(), None, None, None)
+ .expect("read with selector should succeed");
assert_eq!(output.file.content, "line1\nline2\nline3\nline4\nline5");
assert_eq!(output.file.start_line, 1);
assert_eq!(output.file.num_lines, 5);
diff --git a/rust/crates/runtime/src/lib.rs b/rust/crates/runtime/src/lib.rs
index 5e38aea2..4691f941 100644
--- a/rust/crates/runtime/src/lib.rs
+++ b/rust/crates/runtime/src/lib.rs
@@ -88,10 +88,10 @@ pub use conversation::{
};
pub use file_ops::{
edit_file, edit_file_in_workspace, glob_search, glob_search_in_workspace, grep_search,
- grep_search_in_workspace, read_file, read_file_in_workspace, read_file_with_selector,
- read_file_in_workspace_with_selector, write_file, write_file_in_workspace, EditFileOutput,
- GlobSearchOutput, GrepSearchInput, GrepSearchOutput, ReadFileOutput, StructuredPatchHunk,
- TextFilePayload, WriteFileOutput,
+ grep_search_in_workspace, read_file, read_file_in_workspace,
+ read_file_in_workspace_with_selector, read_file_with_selector, write_file,
+ write_file_in_workspace, EditFileOutput, GlobSearchOutput, GrepSearchInput, GrepSearchOutput,
+ ReadFileOutput, StructuredPatchHunk, TextFilePayload, WriteFileOutput,
};
pub use git_context::{GitCommitEntry, GitContext};
pub use hooks::{
diff --git a/rust/crates/runtime/src/line_range_selector.rs b/rust/crates/runtime/src/line_range_selector.rs
index cd2abe5f..13affe15 100644
--- a/rust/crates/runtime/src/line_range_selector.rs
+++ b/rust/crates/runtime/src/line_range_selector.rs
@@ -8,7 +8,6 @@
/// - `:5-16,960-973` = multiple ranges
/// - `:raw` = full verbatim
/// - `:conflicts` = git merge conflicts only
-
use std::num::ParseIntError;
/// Parsed line range specification.
@@ -36,12 +35,18 @@ pub struct LineRange {
impl LineRange {
/// Create a new line range (1-indexed).
pub fn new(start_line: usize, end_line: usize) -> Self {
- Self { start_line, end_line }
+ Self {
+ start_line,
+ end_line,
+ }
}
/// Convert to zero-indexed range for internal use.
pub fn zero_indexed(&self) -> (usize, usize) {
- (self.start_line.saturating_sub(1), self.end_line.saturating_sub(1))
+ (
+ self.start_line.saturating_sub(1),
+ self.end_line.saturating_sub(1),
+ )
}
/// Get the number of lines in this range.
diff --git a/rust/crates/tools/src/lib.rs b/rust/crates/tools/src/lib.rs
index e3c22c28..627adfb4 100644
--- a/rust/crates/tools/src/lib.rs
+++ b/rust/crates/tools/src/lib.rs
@@ -2575,7 +2575,8 @@ fn run_read_file(input: ReadFileInput) -> Result<String, String> {
input.limit,
input.selector.as_deref(),
&workspace,
- ).map_err(io_to_string)?,
+ )
+ .map_err(io_to_string)?,
)
}
@@ -10704,8 +10705,7 @@ printf 'pwsh:%s' "$1"
let root = temp_path("perm-read-selector");
fs::create_dir_all(&root).expect("create root");
let file = root.join("multi-line.txt");
- fs::write(&file, "line1\nline2\nline3\nline4\nline5\n")
- .expect("write test file");
+ fs::write(&file, "line1\nline2\nline3\nline4\nline5\n").expect("write test file");
let original_dir = std::env::current_dir().expect("cwd");
std::env::set_current_dir(&root).expect("set cwd");
@@ -10717,7 +10717,10 @@ printf 'pwsh:%s' "$1"
"selector": "2-4"
}),
);
- assert!(result.is_ok(), "read_file with selector should succeed: {result:?}");
+ assert!(
+ result.is_ok(),
+ "read_file with selector should succeed: {result:?}"
+ );
// Verify the output contains the expected lines
let output: serde_json::Value =