From ac25be4138b639fc9a6e9374195ac5357728534c Mon Sep 17 00:00:00 2001 From: Andrei Serban Date: Thu, 26 Dec 2024 17:26:24 +0200 Subject: [PATCH] clippy --- src-tauri/src/git/git_commit.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/git/git_commit.rs b/src-tauri/src/git/git_commit.rs index d6d8b2c..93bb33f 100644 --- a/src-tauri/src/git/git_commit.rs +++ b/src-tauri/src/git/git_commit.rs @@ -1,7 +1,7 @@ use super::{ git_commit_author::{GitCommitAuthor, GitCommitAuthorType}, git_files::GitFilesRequired, - git_folders::{GitFolders, GIT_FOLDER}, + git_folders::GIT_FOLDER, git_project::GitProject, git_tree::GitTree, object::{GitObject, Header}, @@ -9,11 +9,7 @@ use super::{ use crate::errors::git_object_error::{CommitError, GitObjectError}; use core::fmt; use serde::{Deserialize, Serialize}; -use std::{ - fs::{self, OpenOptions}, - io::Write, - path::{Path, PathBuf}, -}; +use std::{fs::OpenOptions, io::Write, path::PathBuf}; pub enum CommitPrefix { Tree, @@ -163,11 +159,15 @@ impl GitCommit { */ pub fn checkout(&self, project: &GitProject) -> Result<(), GitObjectError> { let files = - GitTree::from_hash(project, &self.get_tree_hash())?.get_object_blobs(project, None); + GitTree::from_hash(project, self.get_tree_hash())?.get_object_blobs(project, None); - let _ = files.iter().for_each(|file| { + files.iter().for_each(|file| { let path = PathBuf::from(project.get_directory()).join(&file.0); - let file_in_fs = OpenOptions::new().write(true).create(true).open(path); + let file_in_fs = OpenOptions::new() + .write(true) + .truncate(true) + .create(true) + .open(path); if let Ok(mut file_in_fs) = file_in_fs { let _ = file_in_fs.write_all(file.1.data());