Skip to content

Commit e9a47da

Browse files
tesujialexcrichton
authored andcommitted
apply some style fix from clippy
1 parent 9a2ef96 commit e9a47da

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/legacy.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,7 @@ pub fn demangle(s: &str) -> Result<(Demangle, &str), ()> {
9494
elements += 1;
9595
}
9696

97-
Ok((
98-
Demangle {
99-
inner: inner,
100-
elements: elements,
101-
},
102-
chars.as_str(),
103-
))
97+
Ok((Demangle { inner, elements }, chars.as_str()))
10498
}
10599

106100
// Rust hashes are hex digits with an `h` prepended.
@@ -142,7 +136,7 @@ impl<'a> fmt::Display for Demangle<'a> {
142136
}
143137
} else if rest.starts_with('$') {
144138
let (escape, after_escape) = if let Some(end) = rest[1..].find('$') {
145-
(&rest[1..end + 1], &rest[end + 2..])
139+
(&rest[1..=end], &rest[end + 2..])
146140
} else {
147141
break;
148142
};

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn demangle(mut s: &str) -> Demangle {
9797
// Output like LLVM IR adds extra period-delimited words. See if
9898
// we are in that case and save the trailing words if so.
9999
if !suffix.is_empty() {
100-
if suffix.starts_with(".") && is_symbol_like(suffix) {
100+
if suffix.starts_with('.') && is_symbol_like(suffix) {
101101
// Keep the suffix.
102102
} else {
103103
// Reset the suffix and invalidate the demangling.
@@ -107,9 +107,9 @@ pub fn demangle(mut s: &str) -> Demangle {
107107
}
108108

109109
Demangle {
110-
style: style,
110+
style,
111111
original: s,
112-
suffix: suffix,
112+
suffix,
113113
}
114114
}
115115

src/v0.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn demangle(s: &str) -> Result<(Demangle, &str), Invalid> {
1919
let inner;
2020
if s.len() > 2 && s.starts_with("_R") {
2121
inner = &s[2..];
22-
} else if s.len() > 1 && s.starts_with("R") {
22+
} else if s.len() > 1 && s.starts_with('R') {
2323
// On Windows, dbghelp strips leading underscores, so we accept "R..."
2424
// form too.
2525
inner = &s[1..];
@@ -56,7 +56,7 @@ pub fn demangle(s: &str) -> Result<(Demangle, &str), Invalid> {
5656
_ => {}
5757
}
5858

59-
Ok((Demangle { inner: inner }, &parser.sym[parser.next..]))
59+
Ok((Demangle { inner }, &parser.sym[parser.next..]))
6060
}
6161

6262
impl<'s> Display for Demangle<'s> {

0 commit comments

Comments
 (0)