Skip to content

Commit

Permalink
Restructure app a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
sondr3 committed May 12, 2020
1 parent 8358880 commit d9f5571
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 25 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ categories = ["command-line-utilities"]

[[bin]]
name = "git-anger-management"
path = "src/bin.rs"
path = "src/bin/main.rs"

[profile.release]
lto = "thin"

[features]
fail-on-warnings = []

[dependencies]
structopt = "0.3.14"
prettytable-rs = "0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion src/bin.rs → src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use console::Term;
use git2::Repository;
use git_anger_management::Repo;
use git_anger_management::repo::Repo;
use std::env;
use std::error::Error;
use std::path::PathBuf;
Expand Down
2 changes: 2 additions & 0 deletions src/core.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use once_cell::sync::OnceCell;
use std::collections::HashSet;

/// Statically include the word list for curse words
pub static CURSES_FILE: &str = include_str!("words.txt");

fn curses() -> &'static HashSet<&'static str> {
static INSTANCE: OnceCell<HashSet<&'static str>> = OnceCell::new();
INSTANCE.get_or_init(|| CURSES_FILE.lines().collect())
Expand Down
24 changes: 6 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,9 @@
//!
//! Or look at the help by running `git anger-management -h`.
#![doc(html_root_url = "https://docs.rs/git-anger-management/0.6.0")]
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
#![forbid(unsafe_code)]
#![deny(
clippy::all,
missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
unused_import_braces,
unused_allocation
)]
mod author;
mod core;
mod repo;

pub use crate::author::Author;
pub use crate::core::{naughty_word, split_into_clean_words};
pub use crate::repo::Repo;
/// A git author
pub mod author;
/// Core algorithms and functionality
pub mod core;
/// A simplified representation of a git repository
pub mod repo;
2 changes: 1 addition & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::author::Author;
use crate::{naughty_word, split_into_clean_words};
use crate::core::{naughty_word, split_into_clean_words};
use git2::{Commit, Repository};
use prettytable::{format, Cell, Row, Table};
use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion tests/repo_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use git2::Repository;
use git_anger_management::Repo;
use git_anger_management::repo::Repo;
use std::path::{Path, PathBuf};

#[test]
Expand Down

0 comments on commit d9f5571

Please sign in to comment.