diff options
author | Tim Oram <dev@mitmaro.ca> | 2019-10-17 21:48:22 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2019-12-28 16:16:00 -0330 |
commit | f97e2597709b6da6cd99cb42ea13dc25106795c2 (patch) | |
tree | e74c92945a5dc78201532a698ae6995d1414710c /src/config/utils.rs | |
parent | 01f1b82bcb99bfb9175bfcef5d1b3dca90890a8c (diff) |
Update visibility to be required minimum
This change updates the usages of `pub` to be the minimum level of
visibility needed. This also required cleaning up some of the use
statements to use a simpler set of imports.
Diffstat (limited to 'src/config/utils.rs')
-rw-r--r-- | src/config/utils.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/config/utils.rs b/src/config/utils.rs index 5251549..a5436ee 100644 --- a/src/config/utils.rs +++ b/src/config/utils.rs @@ -1,8 +1,8 @@ -use crate::display::Color; +use crate::display::color::Color; use std::convert::TryFrom; use std::env; -pub(in crate::config) fn get_input(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { +pub(super) fn get_input(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { let value = get_string(config, name, default)?; match value.to_lowercase().as_ref() { @@ -24,7 +24,7 @@ pub(in crate::config) fn get_input(config: &git2::Config, name: &str, default: & } } -pub(in crate::config) fn get_string(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { +pub(super) fn get_string(config: &git2::Config, name: &str, default: &str) -> Result<String, String> { match config.get_string(name) { Ok(v) => Ok(v), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(String::from(default)), @@ -32,7 +32,7 @@ pub(in crate::config) fn get_string(config: &git2::Config, name: &str, default: } } -pub(in crate::config) fn get_bool(config: &git2::Config, name: &str, default: bool) -> Result<bool, String> { +pub(super) fn get_bool(config: &git2::Config, name: &str, default: bool) -> Result<bool, String> { match config.get_bool(name) { Ok(v) => Ok(v), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(default), @@ -40,7 +40,7 @@ pub(in crate::config) fn get_bool(config: &git2::Config, name: &str, default: bo } } -pub(in crate::config) fn get_color(config: &git2::Config, name: &str, default_color: Color) -> Result<Color, String> { +pub(super) fn get_color(config: &git2::Config, name: &str, default_color: Color) -> Result<Color, String> { match config.get_string(name) { Ok(v) => Color::try_from(v.to_lowercase().as_str()), Err(ref e) if e.code() == git2::ErrorCode::NotFound => Ok(default_color), @@ -48,13 +48,13 @@ pub(in crate::config) fn get_color(config: &git2::Config, name: &str, default_co } } -pub(in crate::config) fn editor_from_env() -> String { +pub(super) fn editor_from_env() -> String { env::var("VISUAL") .or_else(|_| env::var("EDITOR")) .unwrap_or_else(|_| String::from("vi")) } -pub(in crate::config) fn open_git_config() -> Result<git2::Config, String> { +pub(super) fn open_git_config() -> Result<git2::Config, String> { match git2::Repository::open_from_env() { Ok(f) => { match f.config() { |