chore: fix clippy
All checks were successful
CI checks / Format (push) Successful in 26s
CI checks / Clippy (push) Successful in 37s

This commit is contained in:
Patrick MARIE 2025-02-04 20:27:15 +01:00
parent 95d37159fc
commit bfc0e7f7b7
Signed by: mycroft
GPG Key ID: BB519E5CD8E7BFA7
3 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,6 @@
#[derive(thiserror::Error, Debug)]
use thiserror::Error;
#[derive(Error, Debug)]
pub enum RuntimeError {
#[error("Invalid character found")]
UnexpectedChar,

View File

@ -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),
},
}

View File

@ -62,7 +62,7 @@ pub fn read_object(path: &Path, object: &str) -> Result<Object<impl BufRead>> {
}
impl<R: BufRead> Object<R> {
pub fn to_string(&mut self) -> Result<String> {
pub fn string(&mut self) -> Result<String> {
let mut buf: Vec<u8> = Vec::new();
let mut buf_hash: [u8; 20] = [0; 20];