fix(typos)!: Clarify Case::Uppers name

`Scream` was referrin to `SCREAMING_CASE` but outside of that context, I
think `Upper` is more accurate.
This commit is contained in:
Ed Page 2021-04-21 20:36:35 -05:00
parent 969f4f88be
commit 9bfb506c6d
2 changed files with 13 additions and 13 deletions

View file

@ -305,7 +305,7 @@ impl<'s> Iterator for SplitIdent<'s> {
(WordMode::Uppercase, WordMode::Uppercase, WordMode::Lowercase) => { (WordMode::Uppercase, WordMode::Uppercase, WordMode::Lowercase) => {
let result = Word::new_unchecked( let result = Word::new_unchecked(
&self.ident[self.start..i], &self.ident[self.start..i],
Case::Scream, Case::Upper,
self.start + self.offset, self.start + self.offset,
); );
self.start = i; self.start = i;
@ -336,7 +336,7 @@ impl<'s> Iterator for SplitIdent<'s> {
pub enum Case { pub enum Case {
Title, Title,
Lower, Lower,
Scream, Upper,
None, None,
} }
@ -373,7 +373,7 @@ impl WordMode {
fn case(self, last: WordMode) -> Case { fn case(self, last: WordMode) -> Case {
match (self, last) { match (self, last) {
(WordMode::Uppercase, WordMode::Uppercase) => Case::Scream, (WordMode::Uppercase, WordMode::Uppercase) => Case::Upper,
(WordMode::Uppercase, WordMode::Lowercase) => Case::Title, (WordMode::Uppercase, WordMode::Lowercase) => Case::Title,
(WordMode::Lowercase, WordMode::Lowercase) => Case::Lower, (WordMode::Lowercase, WordMode::Lowercase) => Case::Lower,
(WordMode::Number, WordMode::Number) => Case::None, (WordMode::Number, WordMode::Number) => Case::None,
@ -519,21 +519,21 @@ mod test {
"MyClass", "MyClass",
&[("My", Case::Title, 0), ("Class", Case::Title, 2)], &[("My", Case::Title, 0), ("Class", Case::Title, 2)],
), ),
("MyC", &[("My", Case::Title, 0), ("C", Case::Scream, 2)]), ("MyC", &[("My", Case::Title, 0), ("C", Case::Upper, 2)]),
("HTML", &[("HTML", Case::Scream, 0)]), ("HTML", &[("HTML", Case::Upper, 0)]),
( (
"PDFLoader", "PDFLoader",
&[("PDF", Case::Scream, 0), ("Loader", Case::Title, 3)], &[("PDF", Case::Upper, 0), ("Loader", Case::Title, 3)],
), ),
( (
"AString", "AString",
&[("A", Case::Scream, 0), ("String", Case::Title, 1)], &[("A", Case::Upper, 0), ("String", Case::Title, 1)],
), ),
( (
"SimpleXMLTokenizer", "SimpleXMLTokenizer",
&[ &[
("Simple", Case::Title, 0), ("Simple", Case::Title, 0),
("XML", Case::Scream, 6), ("XML", Case::Upper, 6),
("Tokenizer", Case::Title, 9), ("Tokenizer", Case::Title, 9),
], ],
), ),
@ -541,14 +541,14 @@ mod test {
"vimRPCPlugin", "vimRPCPlugin",
&[ &[
("vim", Case::Lower, 0), ("vim", Case::Lower, 0),
("RPC", Case::Scream, 3), ("RPC", Case::Upper, 3),
("Plugin", Case::Title, 6), ("Plugin", Case::Title, 6),
], ],
), ),
( (
"GL11Version", "GL11Version",
&[ &[
("GL", Case::Scream, 0), ("GL", Case::Upper, 0),
("11", Case::None, 2), ("11", Case::None, 2),
("Version", Case::Title, 4), ("Version", Case::Title, 4),
], ],
@ -560,7 +560,7 @@ mod test {
("May5", &[("May", Case::Title, 0), ("5", Case::None, 3)]), ("May5", &[("May", Case::Title, 0), ("5", Case::None, 3)]),
( (
"BFG9000", "BFG9000",
&[("BFG", Case::Scream, 0), ("9000", Case::None, 3)], &[("BFG", Case::Upper, 0), ("9000", Case::None, 3)],
), ),
]; ];
for (input, expected) in cases.iter() { for (input, expected) in cases.iter() {

View file

@ -147,7 +147,7 @@ fn case_correct(correction: &mut Cow<'_, str>, case: Case) {
s[0..1].make_ascii_uppercase(); s[0..1].make_ascii_uppercase();
} }
}, },
Case::Scream => match correction { Case::Upper => match correction {
Cow::Borrowed(s) => { Cow::Borrowed(s) => {
let mut s = String::from(*s); let mut s = String::from(*s);
s.make_ascii_uppercase(); s.make_ascii_uppercase();
@ -241,7 +241,7 @@ mod test {
("foo", Case::Lower, "foo"), ("foo", Case::Lower, "foo"),
("foo", Case::None, "foo"), ("foo", Case::None, "foo"),
("foo", Case::Title, "Foo"), ("foo", Case::Title, "Foo"),
("foo", Case::Scream, "FOO"), ("foo", Case::Upper, "FOO"),
("fOo", Case::None, "fOo"), ("fOo", Case::None, "fOo"),
]; ];
for (correction, case, expected) in cases.iter() { for (correction, case, expected) in cases.iter() {