清除警告

This commit is contained in:
HouXiaoxuan
2023-12-22 03:38:04 +08:00
parent b0172211a0
commit 80ab4c1052
3 changed files with 3 additions and 19 deletions

View File

@@ -1,7 +1,5 @@
use crate::{head, models::commit::Commit};
use colored::Colorize;
use core::num;
use std::option;
const DEFAULT_LOG_NUMBER: usize = 10;
@@ -40,26 +38,13 @@ pub fn __log(all: bool, number: Option<usize>) -> usize {
if first {
// TODO: (HEAD -> ttt, ad2)
first = false;
print!(
"{}{}{}{}",
"commit ".yellow(),
commit.get_hash().yellow(),
"(".yellow(),
"HEAD".blue()
);
print!("{}{}{}{}", "commit ".yellow(), commit.get_hash().yellow(), "(".yellow(), "HEAD".blue());
if let Some(ref branch_name) = branch_name {
print!("{}", format!(" -> {}", branch_name).blue());
}
println!("{}", ")".yellow());
} else {
println!(
"{}{}{}{}{}",
"commit ".yellow(),
head_commit.yellow(),
"(".yellow(),
"HEAD".blue(),
")".yellow()
);
println!("{}{}{}{}{}", "commit ".yellow(), head_commit.yellow(), "(".yellow(), "HEAD".blue(), ")".yellow());
}
println!("Author: {}", commit.get_author());
println!("Date: {}", commit.get_date());

View File

@@ -2,7 +2,6 @@ use crate::models::blob::Blob;
use crate::models::object::Hash;
use crate::utils::util;
use crate::utils::util::get_relative_path;
use colored::Colorize;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;

View File

@@ -1,6 +1,6 @@
use std::path::PathBuf;
use crate::models::object::{self, Hash};
use crate::models::object::Hash;
use super::utils::util;