Skip to content

Commit 9e4e4c4

Browse files
committed
refactor (#450)
1 parent d6ef2ce commit 9e4e4c4

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ check: ## Build all code in suitable configurations
7373
&& cargo check --features verbose-object-parsing-errors
7474
cd git-index && cargo check --features serde1
7575
cd git-credentials && cargo check --features serde1
76-
cd git-sec && cargo check --features serde1 \
77-
cargo check --features thiserror
76+
cd git-sec && cargo check --features serde1
7877
cd git-revision && cargo check --features serde1
7978
cd git-attributes && cargo check --features serde1
8079
cd git-glob && cargo check --features serde1

git-repository/src/config/cache/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Cache {
8080
"HOME" => Some(home_env),
8181
_ => None,
8282
}
83-
.and_then(|perm| std::env::var_os(name).and_then(|val| perm.check(val).ok().flatten()))
83+
.and_then(|perm| std::env::var_os(name).and_then(|val| perm.check_opt(val)))
8484
})
8585
.map(|p| (source, p.into_owned()))
8686
}
@@ -189,6 +189,6 @@ impl Cache {
189189
pub fn home_dir(&self) -> Option<PathBuf> {
190190
std::env::var_os("HOME")
191191
.map(PathBuf::from)
192-
.and_then(|path| self.home_env.check(path).ok().flatten())
192+
.and_then(|path| self.home_env.check_opt(path))
193193
}
194194
}

git-repository/src/open.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl ThreadSafeRepository {
356356
let git_install_dir = crate::path::install_dir().ok();
357357
let home = std::env::var_os("HOME")
358358
.map(PathBuf::from)
359-
.and_then(|home| env.home.check(home).ok().flatten());
359+
.and_then(|home| env.home.check_opt(home));
360360

361361
let mut filter_config_section = filter_config_section.unwrap_or(config::section::is_trusted);
362362
let config = config::Cache::from_stage_one(

git-repository/src/remote/url/scheme_permission.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl SchemePermission {
103103

104104
let user_allowed = saw_user.then(|| {
105105
std::env::var_os("GIT_PROTOCOL_FROM_USER")
106-
.and_then(|val| git_prefix.check(val).ok().flatten())
106+
.and_then(|val| git_prefix.check_opt(val))
107107
.map_or(true, |val| val == "1")
108108
});
109109
Ok(SchemePermission {

0 commit comments

Comments
 (0)