Skip to content

Commit 16282a5

Browse files
committed
---
yaml --- r: 135387 b: refs/heads/snap-stage3 c: 4504412 h: refs/heads/master i: 135385: 098e751 135383: b9b8b4b v: v3
1 parent 6676f8f commit 16282a5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 74090504219e4e37c1a6d9fdd8600f44b51c7b04
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 333592edde810324c9730a89372fa5164d10871d
4+
refs/heads/snap-stage3: 45044124e46bbfd1ab9869ffce71259ae93866ff
55
refs/heads/try: 14378ea357c06c23607ca61ade44f60a7a64a1c7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/lint/builtin.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,13 +871,17 @@ impl NonSnakeCase {
871871
fn to_snake_case(str: &str) -> String {
872872
let mut words = vec![];
873873
for s in str.split('_') {
874+
let mut last_upper = false;
874875
let mut buf = String::new();
875876
if s.is_empty() { continue; }
876877
for ch in s.chars() {
877-
if !buf.is_empty() && buf.as_slice() != "'" && ch.is_uppercase() {
878+
if !buf.is_empty() && buf.as_slice() != "'"
879+
&& ch.is_uppercase()
880+
&& !last_upper {
878881
words.push(buf);
879882
buf = String::new();
880883
}
884+
last_upper = ch.is_uppercase();
881885
buf.push_char(ch.to_lowercase());
882886
}
883887
words.push(buf);

branches/snap-stage3/src/test/compile-fail/lint-non-snake-case-functions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ impl Foo {
2323

2424
pub fn xyZ(&mut self) {}
2525
//~^ ERROR method `xyZ` should have a snake case name such as `xy_z`
26+
27+
fn render_HTML() {}
28+
//~^ ERROR method `render_HTML` should have a snake case name such as `render_html`
2629
}
2730

2831
trait X {
2932
fn ABC();
30-
//~^ ERROR trait method `ABC` should have a snake case name such as `a_b_c`
33+
//~^ ERROR trait method `ABC` should have a snake case name such as `abc`
3134

3235
fn a_b_C(&self) {}
3336
//~^ ERROR trait method `a_b_C` should have a snake case name such as `a_b_c`

0 commit comments

Comments
 (0)