apply some style fix from clippy
diff --git a/src/legacy.rs b/src/legacy.rs
index 1ccfef1..d55f3a1 100644
--- a/src/legacy.rs
+++ b/src/legacy.rs
@@ -94,13 +94,7 @@
elements += 1;
}
- Ok((
- Demangle {
- inner: inner,
- elements: elements,
- },
- chars.as_str(),
- ))
+ Ok((Demangle { inner, elements }, chars.as_str()))
}
// Rust hashes are hex digits with an `h` prepended.
@@ -142,7 +136,7 @@
}
} else if rest.starts_with('$') {
let (escape, after_escape) = if let Some(end) = rest[1..].find('$') {
- (&rest[1..end + 1], &rest[end + 2..])
+ (&rest[1..=end], &rest[end + 2..])
} else {
break;
};
diff --git a/src/lib.rs b/src/lib.rs
index 49ec429..2b8684e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -97,7 +97,7 @@
// Output like LLVM IR adds extra period-delimited words. See if
// we are in that case and save the trailing words if so.
if !suffix.is_empty() {
- if suffix.starts_with(".") && is_symbol_like(suffix) {
+ if suffix.starts_with('.') && is_symbol_like(suffix) {
// Keep the suffix.
} else {
// Reset the suffix and invalidate the demangling.
@@ -107,9 +107,9 @@
}
Demangle {
- style: style,
+ style,
original: s,
- suffix: suffix,
+ suffix,
}
}
diff --git a/src/v0.rs b/src/v0.rs
index e83a220..7fd0cf1 100644
--- a/src/v0.rs
+++ b/src/v0.rs
@@ -19,7 +19,7 @@
let inner;
if s.len() > 2 && s.starts_with("_R") {
inner = &s[2..];
- } else if s.len() > 1 && s.starts_with("R") {
+ } else if s.len() > 1 && s.starts_with('R') {
// On Windows, dbghelp strips leading underscores, so we accept "R..."
// form too.
inner = &s[1..];
@@ -56,7 +56,7 @@
_ => {}
}
- Ok((Demangle { inner: inner }, &parser.sym[parser.next..]))
+ Ok((Demangle { inner }, &parser.sym[parser.next..]))
}
impl<'s> Display for Demangle<'s> {