Skip to content

Commit 58e1638

Browse files
author
Abderraouf Belalia
committed
style: fix formatting and clippy warnings
[agent commit]
1 parent 0f5f44f commit 58e1638

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/fs_service.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ impl FileSystemService {
575575
Ok(base64_string)
576576
}
577577

578-
pub async fn read_text_file(&self, file_path: &Path, with_line_numbers: bool) -> ServiceResult<String> {
578+
pub async fn read_text_file(
579+
&self,
580+
file_path: &Path,
581+
with_line_numbers: bool,
582+
) -> ServiceResult<String> {
579583
let allowed_directories = self.allowed_directories().await;
580584
let valid_path = self.validate_path(file_path, allowed_directories)?;
581585
let content = tokio::fs::read_to_string(valid_path).await?;

tests/test_fs_service.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ async fn test_read_text_file_with_line_numbers() {
240240
let file_path = create_temp_file(
241241
temp_dir.join("dir1").as_path(),
242242
"test.txt",
243-
"line1\nline2\nline3"
243+
"line1\nline2\nline3",
244244
);
245245
let content = service.read_text_file(&file_path, true).await.unwrap();
246246
assert_eq!(content, " 1 | line1\n 2 | line2\n 3 | line3");
@@ -252,7 +252,7 @@ async fn test_read_text_file_without_line_numbers() {
252252
let file_path = create_temp_file(
253253
temp_dir.join("dir1").as_path(),
254254
"test.txt",
255-
"line1\nline2\nline3"
255+
"line1\nline2\nline3",
256256
);
257257
let content = service.read_text_file(&file_path, false).await.unwrap();
258258
assert_eq!(content, "line1\nline2\nline3");
@@ -280,7 +280,7 @@ async fn test_read_text_file_with_line_numbers_no_trailing_newline() {
280280
let file_path = create_temp_file(
281281
temp_dir.join("dir1").as_path(),
282282
"no_newline.txt",
283-
"line1\nline2"
283+
"line1\nline2",
284284
);
285285
let content = service.read_text_file(&file_path, true).await.unwrap();
286286
assert_eq!(content, " 1 | line1\n 2 | line2");
@@ -292,14 +292,10 @@ async fn test_read_text_file_with_line_numbers_large_file() {
292292
// Create a file with more than 999 lines to test padding
293293
let mut lines = Vec::new();
294294
for i in 1..=1000 {
295-
lines.push(format!("line{}", i));
295+
lines.push(format!("line{i}"));
296296
}
297297
let file_content = lines.join("\n");
298-
let file_path = create_temp_file(
299-
temp_dir.join("dir1").as_path(),
300-
"large.txt",
301-
&file_content
302-
);
298+
let file_path = create_temp_file(temp_dir.join("dir1").as_path(), "large.txt", &file_content);
303299
let content = service.read_text_file(&file_path, true).await.unwrap();
304300

305301
// Check first line

0 commit comments

Comments
 (0)