Switch to 2018 edition

This commit is contained in:
Ruben Schmidmeister 2020-12-17 16:51:13 +01:00
parent f40c0f6e21
commit 995565b73e
No known key found for this signature in database
GPG Key ID: 29289CC82C8A0C74
9 changed files with 31 additions and 17 deletions

View File

@ -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"

View File

@ -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
@ -19,7 +21,7 @@ pub trait CamelCase: ToOwned {
impl CamelCase for str {
fn to_camel_case(&self) -> String {
::transform(self, ::capitalize, |_| {})
transform(self, capitalize, |_| {})
}
}

View File

@ -1,3 +1,5 @@
use crate::{lowercase, transform};
/// This trait defines a kebab case conversion.
///
/// In kebab-case, word boundaries are indicated by hyphens.
@ -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('-'))
}
}

View File

@ -36,7 +36,6 @@
//! 6. Title Case
//! 7. SHOUTY-KEBAB-CASE
#![deny(missing_docs)]
extern crate unicode_segmentation;
mod camel;
mod kebab;
@ -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;

View File

@ -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
@ -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) }
}, |_| {})
}
}

View File

@ -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
@ -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('-'))
}
}

View File

@ -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
@ -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('_'))
}
}

View File

@ -1,3 +1,5 @@
use crate::{lowercase, transform};
/// This trait defines a snake case conversion.
///
/// In snake_case, word boundaries are indicated by underscores.
@ -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('_'))
}
}

View File

@ -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
@ -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(' '))
}
}