Fix more Clippy warnings

cargo clippy -- -W clippy::correctness
This commit is contained in:
Thibaut Brandscheid
2019-12-07 10:34:32 +01:00
parent dfa5173cf4
commit 683f4c35d9
21 changed files with 395 additions and 455 deletions

View File

@ -52,8 +52,7 @@ pub fn build() -> Result<(), Box<dyn std::error::Error>> {
if all_on && !flags.is_empty() {
println!(
"cargo:warning={}",
"Both NUSHELL_ENABLE_ALL_FLAGS and NUSHELL_ENABLE_FLAGS were set. You don't need both."
"cargo:warning=Both NUSHELL_ENABLE_ALL_FLAGS and NUSHELL_ENABLE_FLAGS were set. You don't need both."
);
}

View File

@ -20,12 +20,12 @@ impl PrettyDebug for PositionalType {
fn pretty(&self) -> DebugDocBuilder {
match self {
PositionalType::Mandatory(string, shape) => {
b::description(string) + b::delimit("(", shape.pretty(), ")").as_kind().group()
b::description(string) + b::delimit("(", shape.pretty(), ")").into_kind().group()
}
PositionalType::Optional(string, shape) => {
b::description(string)
+ b::operator("?")
+ b::delimit("(", shape.pretty(), ")").as_kind().group()
+ b::delimit("(", shape.pretty(), ")").into_kind().group()
}
}
}

View File

@ -63,7 +63,7 @@ struct DebugEntry<'a> {
impl<'a> PrettyDebug for DebugEntry<'a> {
fn pretty(&self) -> DebugDocBuilder {
(b::key(self.key.to_string()) + b::equals() + self.value.pretty().as_value()).group()
(b::key(self.key.to_string()) + b::equals() + self.value.pretty().into_value()).group()
}
}

View File

@ -135,7 +135,7 @@ impl DebugDocBuilder {
DebugDocBuilder::styled(string, ShellStyle::Value)
}
pub fn as_value(self) -> DebugDocBuilder {
pub fn into_value(self) -> DebugDocBuilder {
self.inner
.annotate(ShellAnnotation::style(ShellStyle::Value))
.into()
@ -149,7 +149,7 @@ impl DebugDocBuilder {
DebugDocBuilder::styled(string, ShellStyle::Kind)
}
pub fn as_kind(self) -> DebugDocBuilder {
pub fn into_kind(self) -> DebugDocBuilder {
self.inner
.annotate(ShellAnnotation::style(ShellStyle::Kind))
.into()