diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-01-18 14:48:59 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-01-18 14:48:59 +0100 |
commit | 0295809436d8e178a7d0528b47b9d4313b292eef (patch) | |
tree | 55671566fb700328c81a34b322cfa55309e098f8 /src/config | |
parent | 5bee5329b823431fd3c971f75281084617766edd (diff) |
Run `cargo fmt`
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/configuration.rs | 3 | ||||
-rw-r--r-- | src/config/container_config.rs | 2 | ||||
-rw-r--r-- | src/config/docker_config.rs | 1 | ||||
-rw-r--r-- | src/config/endpoint_config.rs | 5 | ||||
-rw-r--r-- | src/config/not_validated.rs | 38 | ||||
-rw-r--r-- | src/config/util.rs | 7 |
6 files changed, 33 insertions, 23 deletions
diff --git a/src/config/configuration.rs b/src/config/configuration.rs index aac806c..0913716 100644 --- a/src/config/configuration.rs +++ b/src/config/configuration.rs @@ -15,7 +15,7 @@ use crate::config::NotValidatedConfiguration; /// A valid configuration (validated via NotValidatedConfiguration::validate()) #[derive(Debug)] pub struct Configuration { - pub (in crate::config) inner: NotValidatedConfiguration, + pub(in crate::config) inner: NotValidatedConfiguration, } impl Deref for Configuration { @@ -25,4 +25,3 @@ impl Deref for Configuration { &self.inner } } - diff --git a/src/config/container_config.rs b/src/config/container_config.rs index a8b3bd6..f117351 100644 --- a/src/config/container_config.rs +++ b/src/config/container_config.rs @@ -17,7 +17,6 @@ use crate::util::EnvironmentVariableName; /// The configuration for the containers #[derive(Debug, CopyGetters, Getters, Deserialize)] pub struct ContainerConfig { - /// check environment names whether they're allowed #[getset(get_copy = "pub")] check_env_names: bool, @@ -26,4 +25,3 @@ pub struct ContainerConfig { #[getset(get = "pub")] allowed_env: Vec<EnvironmentVariableName>, } - diff --git a/src/config/docker_config.rs b/src/config/docker_config.rs index a674e9a..1cef561 100644 --- a/src/config/docker_config.rs +++ b/src/config/docker_config.rs @@ -50,4 +50,3 @@ pub struct DockerConfig { #[getset(get = "pub")] endpoints: Vec<Endpoint>, } - diff --git a/src/config/endpoint_config.rs b/src/config/endpoint_config.rs index 028c86f..b1734c8 100644 --- a/src/config/endpoint_config.rs +++ b/src/config/endpoint_config.rs @@ -42,9 +42,8 @@ pub struct Endpoint { /// The type of an endpoint #[derive(Clone, Debug, Deserialize, Eq, PartialEq)] pub enum EndpointType { - #[serde(rename = "socket")] + #[serde(rename = "socket")] Socket, - #[serde(rename = "http")] + #[serde(rename = "http")] Http, } - diff --git a/src/config/not_validated.rs b/src/config/not_validated.rs index 36b467b..7b206e9 100644 --- a/src/config/not_validated.rs +++ b/src/config/not_validated.rs @@ -8,17 +8,17 @@ // SPDX-License-Identifier: EPL-2.0 // -use std::path::PathBuf; use anyhow::anyhow; use anyhow::Context; use anyhow::Result; use getset::Getters; use serde::Deserialize; +use std::path::PathBuf; +use crate::config::util::*; use crate::config::Configuration; use crate::config::ContainerConfig; use crate::config::DockerConfig; -use crate::config::util::*; use crate::package::PhaseName; /// The configuration that is loaded from the filesystem @@ -113,39 +113,52 @@ impl NotValidatedConfiguration { .context("Parsing version of crate (CARGO_PKG_VERSION) into semver::Version object")?; if !self.compatibility.matches(&crate_version) { - return Err(anyhow!("Configuration is not compatible to butido {}", crate_version)) + return Err(anyhow!( + "Configuration is not compatible to butido {}", + crate_version + )); } // Error if linter is not a file if let Some(linter) = self.script_linter.as_ref() { if !linter.is_file() { - return Err(anyhow!("Lint script is not a file: {}", linter.display())) + return Err(anyhow!("Lint script is not a file: {}", linter.display())); } } // Error if staging_directory is not a directory if !self.staging_directory.is_dir() { - return Err(anyhow!("Not a directory: staging = {}", self.staging_directory.display())) + return Err(anyhow!( + "Not a directory: staging = {}", + self.staging_directory.display() + )); } // Error if releases_directory is not a directory if !self.releases_directory.is_dir() { - return Err(anyhow!("Not a directory: releases = {}", self.releases_directory.display())) + return Err(anyhow!( + "Not a directory: releases = {}", + self.releases_directory.display() + )); } // Error if source_cache_root is not a directory if !self.source_cache_root.is_dir() { - return Err(anyhow!("Not a directory: releases = {}", self.source_cache_root.display())) + return Err(anyhow!( + "Not a directory: releases = {}", + self.source_cache_root.display() + )); } // Error if there are no phases configured if self.available_phases.is_empty() { - return Err(anyhow!("No phases configured")) + return Err(anyhow!("No phases configured")); } // Error if script highlighting theme is not valid if let Some(configured_theme) = self.script_highlight_theme.as_ref() { - let allowed_theme_present = [ // from syntect + let allowed_theme_present = [ + // from syntect "base16-ocean.dark", "base16-eighties.dark", "base16-mocha.dark", @@ -153,14 +166,15 @@ impl NotValidatedConfiguration { "InspiredGitHub", "Solarized (dark)", "Solarized (light)", - ].iter().any(|allowed_theme| configured_theme == *allowed_theme); + ] + .iter() + .any(|allowed_theme| configured_theme == *allowed_theme); if !allowed_theme_present { - return Err(anyhow!("Theme not known: {}", configured_theme)) + return Err(anyhow!("Theme not known: {}", configured_theme)); } } Ok(Configuration { inner: self }) } } - diff --git a/src/config/util.rs b/src/config/util.rs index fad9348..4c1deff 100644 --- a/src/config/util.rs +++ b/src/config/util.rs @@ -20,7 +20,8 @@ pub fn default_spinner_format() -> String { } pub fn default_package_print_format() -> String { - String::from(indoc::indoc!(r#" + String::from(indoc::indoc!( + r#" {{i}} - {{p.name}} : {{p.version}} {{~ #if print_any }} ================================== @@ -78,7 +79,8 @@ pub fn default_package_print_format() -> String { {{script}} {{/if~}} {{~ /if ~}} - "#)) + "# + )) } pub fn default_strict_script_interpolation() -> bool { @@ -92,4 +94,3 @@ pub fn default_script_shebang() -> String { pub fn default_build_error_lines() -> usize { 10 } - |