Skip to content

Commit

Permalink
Reformat the code; #20
Browse files Browse the repository at this point in the history
  • Loading branch information
msuchane committed Feb 27, 2024
1 parent a9e7cbd commit 297b9c4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cmd_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
use std::path::PathBuf;

use bpaf::Bpaf;
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};

/// Generate pre-populated module files formatted with AsciiDoc that are used in Red Hat and Fedora documentation.
#[derive(Clone, Debug, Bpaf, Default)]
Expand Down
19 changes: 10 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ use std::path::PathBuf;

use color_eyre::eyre::{Result, WrapErr};
use directories::ProjectDirs;
use figment::{Figment, providers::{Format, Toml, Serialized}};
use serde::{Serialize, Deserialize};
use figment::{
providers::{Format, Serialized, Toml},
Figment,
};
use serde::{Deserialize, Serialize};

use crate::cmd_line::{Cli, Comments, Verbosity};

Expand Down Expand Up @@ -118,11 +121,7 @@ impl Default for Options {
/// with a dot at the start, such as `.newdoc.toml`, or
/// a regular, visible file, such as `newdoc.toml`.
fn config_file_name(hidden: bool) -> String {
let prefix = if hidden {
"."
} else {
""
};
let prefix = if hidden { "." } else { "" };
format!("{prefix}{PKG_NAME}.toml")
}

Expand Down Expand Up @@ -170,12 +169,14 @@ pub fn merge_configs(cli_options: Options) -> Result<Options> {

if let Some(git_conf_file) = git_conf_file(&cli_options) {
log::info!("Git repo configuration file: {}", git_conf_file.display());
figment = figment.merge(Toml::file(git_conf_file));
figment = figment.merge(Toml::file(git_conf_file));
}

log::debug!("Figment configuration: {figment:#?}");

let mut conf_options: Options = figment.extract().wrap_err("Failed to load configuration files.")?;
let mut conf_options: Options = figment
.extract()
.wrap_err("Failed to load configuration files.")?;

conf_options.update_from_non_default(&cli_options);

Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub use module::{ContentType, Input, Module};
/// error message through `expect`.
const REGEX_ERROR: &str = "Failed to construct a regular expression. Please report this as a bug";


pub fn run(options: &Options, cli: &Cli) -> Result<()> {
log::debug!("Active options:\n{:#?}", &options);

Expand Down

0 comments on commit 297b9c4

Please sign in to comment.