From bfc0e7f7b70e0248b7ce462121fe2e496553a0c0 Mon Sep 17 00:00:00 2001 From: Patrick Marie Date: Tue, 4 Feb 2025 20:27:15 +0100 Subject: [PATCH] chore: fix clippy --- src/error.rs | 4 +++- src/main.rs | 2 +- src/object.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index d02e483..e2c5dd1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,6 @@ -#[derive(thiserror::Error, Debug)] +use thiserror::Error; + +#[derive(Error, Debug)] pub enum RuntimeError { #[error("Invalid character found")] UnexpectedChar, diff --git a/src/main.rs b/src/main.rs index e713c7a..18f7419 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,7 @@ fn main() -> Result<(), Error> { Err(e) => eprintln!("Failed to initialize repository: {}", e), }, Command::CatFile { hash } => match read_object(&path, &hash) { - Ok(mut obj) => println!("{}", obj.to_string()?), + Ok(mut obj) => println!("{}", obj.string()?), Err(e) => eprintln!("Failed to read object: {}", e), }, } diff --git a/src/object.rs b/src/object.rs index 7af1952..ffaef3c 100644 --- a/src/object.rs +++ b/src/object.rs @@ -62,7 +62,7 @@ pub fn read_object(path: &Path, object: &str) -> Result> { } impl Object { - pub fn to_string(&mut self) -> Result { + pub fn string(&mut self) -> Result { let mut buf: Vec = Vec::new(); let mut buf_hash: [u8; 20] = [0; 20];