Improve readability

Using `Path`s for paths expresses intent more clearly.
This commit is contained in:
Aleksey Kladov authored and David Peter committed 2021-03-07 14:59:10 +01:00
1 parent b489fc75c9
commit 35347c2310
8 files changed
+42 -33

No files matched your search

+1 -2
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()?;