Skip to content

Commit

Permalink
refactor: remove useless fonction to access metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Sep 12, 2021
1 parent 4bdcb3d commit 4379e2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/bin/coco.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Result;
use clap::{App, AppSettings, Arg, Shell, SubCommand};
use cocogitto::CocoGitto;
use cocogitto::COMMITS_METADATA;

const APP_SETTINGS: &[AppSettings] = &[
AppSettings::ArgsNegateSubcommands,
Expand Down Expand Up @@ -56,7 +57,7 @@ fn main() -> Result<()> {
}

fn app<'a, 'b>() -> App<'a, 'b> {
let keys: Vec<&str> = CocoGitto::get_commit_metadata()
let keys: Vec<&str> = COMMITS_METADATA
.iter()
.map(|(commit_type, _)| commit_type.as_ref())
.collect();
Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ lazy_static! {
// This cannot be carried by `Cocogitto` struct since we need it to be available in `Changelog`,
// `Commit` etc. Be ensure that `CocoGitto::new` is called before using this in order to bypass
// unwrapping in case of error.
static ref COMMITS_METADATA: CommitsMetadata = {
pub static ref COMMITS_METADATA: CommitsMetadata = {
if let Ok(repo) = Repository::open(".") {
Settings::get(&repo, None).unwrap_or_default().commit_types()
} else {
Expand Down Expand Up @@ -147,10 +147,6 @@ impl CocoGitto {
})
}

pub fn get_commit_metadata() -> &'static CommitsMetadata {
&COMMITS_METADATA
}

pub fn get_committer(&self) -> Result<String> {
self.repository.get_author()
}
Expand Down

0 comments on commit 4379e2f

Please sign in to comment.