Skip to content

refactor: Using format named variables #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commit_message/message_build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ impl MessageBuilder {
}

pub fn set_body(&mut self, body: &str) {
self.message.push_str(format!("\n\n{}", body).as_str());
self.message.push_str(format!("\n\n{body}").as_str());
}

pub fn set_footer(&mut self, footer: &str) {
self.message.push_str(format!("\n\n{}", footer).as_str());
self.message.push_str(format!("\n\n{footer}").as_str());
}
}
4 changes: 2 additions & 2 deletions src/commit_message/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ impl Prompt {
pub fn optional_input(&self, prompt: &str, label: &str) -> Result<String> {
let input = Text::new(prompt)
.with_render_config(self.config)
.with_help_message(format!("{}. Press Enter to skip", label).as_str())
.with_help_message(format!("{label}. Press Enter to skip").as_str())
.prompt()?;
Ok(input)
}

pub fn required_input(&self, prompt: &str, label: &str) -> Result<String> {
let input = Text::new(prompt)
.with_render_config(self.config)
.with_validator(required!(format!("{} can't be empty", label).as_str()))
.with_validator(required!(format!("{label} can't be empty").as_str()))
.prompt()?;
Ok(input)
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn get_config_path() -> Result<PathBuf> {
pub fn get_pattern(config_path: Option<PathBuf>) -> Result<CommitPattern> {
let default_pattern_str = DEFAULT_CONFIG_FILE;
let selected_config_path = select_custom_config_path(config_path)?;
let pattern_str = get_config_path_content(&selected_config_path)
let pattern_str = get_config_path_content(selected_config_path)
.unwrap_or_else(|_| default_pattern_str.to_owned());
serde_json::from_str(&pattern_str).context("Failed to parse commit pattern from file")
}