Skip to content
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
5 changes: 1 addition & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ pub enum BleurError {
Unknown,
}

pub fn beautiful_exit<T>(message: T) -> !
where
T: AsRef<str>,
{
pub fn beautiful_exit<T: AsRef<str>>(message: T) -> ! {
eprintln!("{} {}", "error:".red(), message.as_ref());

std::process::exit(1)
Expand Down
19 changes: 4 additions & 15 deletions src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ impl ManageBuilder {
})
}

pub fn source<T>(self, url: T) -> Result<Self>
where
T: AsRef<str>,
{
pub fn source<T: AsRef<str>>(self, url: T) -> Result<Self> {
Ok(Self {
temporary: self.temporary,
method: self.method,
Expand All @@ -51,10 +48,7 @@ impl ManageBuilder {
})
}

pub fn fetch_method<T>(self, method: T) -> Result<Self>
where
T: Methodical,
{
pub fn fetch_method<T: Methodical>(self, method: T) -> Result<Self> {
if self.temporary.is_none() || self.remote.is_none() {
return Err(Error::InsufficientArgumentsToDecide);
}
Expand Down Expand Up @@ -153,17 +147,12 @@ impl Manager {

/// For HashMap to implement string search
pub trait Glubtastic {
fn globs<T>(&self, text: T) -> Vec<String>
where
T: AsRef<str>;
fn globs<T: AsRef<str>>(&self, text: T) -> Vec<String>;
}

impl Glubtastic for HashMap<String, String> {
/// Catch all @variable@ references within a string
fn globs<T>(&self, text: T) -> Vec<String>
where
T: AsRef<str>,
{
fn globs<T: AsRef<str>>(&self, text: T) -> Vec<String> {
REGEX
.captures_iter(text.as_ref())
.map(|caps| {
Expand Down
15 changes: 3 additions & 12 deletions src/schemes/template/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ enum Instructions {
Unknown,
}

impl<T> From<T> for Instructions
where
T: ToString,
{
impl<T: ToString> From<T> for Instructions {
fn from(value: T) -> Self {
match value.to_string().to_lowercase().as_str() {
"uppercase" => Self::Uppercase,
Expand All @@ -25,10 +22,7 @@ where
pub struct Apply(Vec<Instructions>);

impl Apply {
pub fn parse<T>(input: T) -> Apply
where
T: ToString,
{
pub fn parse<T: ToString>(input: T) -> Apply {
Apply(
input
.to_string()
Expand All @@ -38,10 +32,7 @@ impl Apply {
)
}

pub fn execute<T>(&self, input: T) -> String
where
T: ToString,
{
pub fn execute<T: ToString>(&self, input: T) -> String {
self.0.iter().fold(
input.to_string(),
|current, instruction| match instruction {
Expand Down