Skip to content

Commit

Permalink
Switch to 2018 edition
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Schmidmeister committed Dec 17, 2020
1 parent f40c0f6 commit 995565b
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 17 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
authors = ["Without Boats <woboats@gmail.com>"]
name = "heck"
version = "0.3.1"
edition = "2018"
license = "MIT OR Apache-2.0"
description = "heck is a case conversion library."
homepage = "https://github.com/withoutboats/heck"
Expand Down
4 changes: 3 additions & 1 deletion src/camel.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{capitalize, transform};

/// This trait defines a camel case conversion.
///
/// In CamelCase, word boundaries are indicated by capital letters, including
Expand All @@ -19,7 +21,7 @@ pub trait CamelCase: ToOwned {

impl CamelCase for str {
fn to_camel_case(&self) -> String {
::transform(self, ::capitalize, |_| {})
transform(self, capitalize, |_| {})
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/kebab.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{lowercase, transform};

/// This trait defines a kebab case conversion.
///
/// In kebab-case, word boundaries are indicated by hyphens.
Expand All @@ -18,7 +20,7 @@ pub trait KebabCase: ToOwned {

impl KebabCase for str {
fn to_kebab_case(&self) -> Self::Owned {
::transform(self, ::lowercase, |s| s.push('-'))
transform(self, lowercase, |s| s.push('-'))
}
}

Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
//! 6. Title Case
//! 7. SHOUTY-KEBAB-CASE
#![deny(missing_docs)]
extern crate unicode_segmentation;

mod camel;
mod kebab;
Expand All @@ -46,13 +45,13 @@ mod shouty_snake;
mod snake;
mod title;

pub use camel::CamelCase;
pub use kebab::KebabCase;
pub use mixed::MixedCase;
pub use shouty_kebab::ShoutyKebabCase;
pub use shouty_snake::{ShoutySnakeCase, ShoutySnekCase};
pub use snake::{SnakeCase, SnekCase};
pub use title::TitleCase;
pub use self::camel::CamelCase;
pub use self::kebab::KebabCase;
pub use self::mixed::MixedCase;
pub use self::shouty_kebab::ShoutyKebabCase;
pub use self::shouty_snake::{ShoutySnakeCase, ShoutySnekCase};
pub use self::snake::{SnakeCase, SnekCase};
pub use self::title::TitleCase;

use unicode_segmentation::UnicodeSegmentation;

Expand Down
8 changes: 5 additions & 3 deletions src/mixed.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{capitalize, lowercase, transform};

/// This trait defines a mixed case conversion.
///
/// In mixedCase, word boundaries are indicated by capital letters, excepting
Expand All @@ -19,9 +21,9 @@ pub trait MixedCase: ToOwned {

impl MixedCase for str {
fn to_mixed_case(&self) -> String {
::transform(self, |s, out| {
if out.is_empty() { ::lowercase(s, out); }
else { ::capitalize(s, out) }
transform(self, |s, out| {
if out.is_empty() { lowercase(s, out); }
else { capitalize(s, out) }
}, |_| {})
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/shouty_kebab.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{transform, uppercase};

/// This trait defines a shouty kebab case conversion.
///
/// In SHOUTY-KEBAB-CASE, word boundaries are indicated by hyphens and all
Expand All @@ -19,7 +21,7 @@ pub trait ShoutyKebabCase: ToOwned {

impl ShoutyKebabCase for str {
fn to_shouty_kebab_case(&self) -> Self::Owned {
::transform(self, ::uppercase, |s| s.push('-'))
transform(self, uppercase, |s| s.push('-'))
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/shouty_snake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{transform, uppercase};

/// This trait defines a shouty snake case conversion.
///
/// In SHOUTY_SNAKE_CASE, word boundaries are indicated by underscores and all
Expand Down Expand Up @@ -34,7 +36,7 @@ impl<T: ?Sized + ShoutySnakeCase> ShoutySnekCase for T {

impl ShoutySnakeCase for str {
fn to_shouty_snake_case(&self) -> Self::Owned {
::transform(self, ::uppercase, |s| s.push('_'))
transform(self, uppercase, |s| s.push('_'))
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/snake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{lowercase, transform};

/// This trait defines a snake case conversion.
///
/// In snake_case, word boundaries are indicated by underscores.
Expand Down Expand Up @@ -31,7 +33,7 @@ impl<T: ?Sized + SnakeCase> SnekCase for T {

impl SnakeCase for str {
fn to_snake_case(&self) -> String {
::transform(self, ::lowercase, |s| s.push('_'))
transform(self, lowercase, |s| s.push('_'))
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/title.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::{capitalize, transform};

/// This trait defines a title case conversion.
///
/// In Title Case, word boundaries are indicated by spaces, and every word is
Expand All @@ -19,7 +21,7 @@ pub trait TitleCase: ToOwned {

impl TitleCase for str {
fn to_title_case(&self) -> String {
::transform(self, ::capitalize, |s| s.push(' '))
transform(self, capitalize, |s| s.push(' '))
}
}

Expand Down

0 comments on commit 995565b

Please sign in to comment.