1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-08 14:22:25 +01:00

Improve readability

Using `Path`s for paths expresses intent more clearly.
This commit is contained in:
Aleksey Kladov
2021-03-02 11:15:49 +03:00
committed by David Peter
parent b489fc75c9
commit 35347c2310
8 changed files with 42 additions and 33 deletions

View File

@@ -1,7 +1,6 @@
#![cfg(feature = "git")]
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
use std::path::Path;
@@ -17,7 +16,7 @@ pub enum LineChange {
pub type LineChanges = HashMap<u32, LineChange>;
pub fn get_git_diff(filename: &OsStr) -> Option<LineChanges> {
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
let repo = Repository::discover(&filename).ok()?;
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;