Fix latest clippy warnings (#3049)

This commit is contained in:
Jonathan Turner
2021-02-12 23:13:14 +13:00
committed by GitHub
parent 041086d22a
commit 5481db4079
213 changed files with 334 additions and 375 deletions

View File

@ -209,10 +209,8 @@ impl Block {
pub fn set_redirect(&mut self, external_redirection: ExternalRedirection) {
if let Some(group) = self.block.last_mut() {
if let Some(pipeline) = group.pipelines.last_mut() {
if let Some(command) = pipeline.list.last_mut() {
if let ClassifiedCommand::Internal(internal) = command {
internal.args.external_redirection = external_redirection;
}
if let Some(ClassifiedCommand::Internal(internal)) = pipeline.list.last_mut() {
internal.args.external_redirection = external_redirection;
}
}
}

View File

@ -389,20 +389,20 @@ pub enum Column {
Value,
}
impl Into<Column> for String {
fn into(self) -> Column {
Column::String(self)
impl From<String> for Column {
fn from(x: String) -> Self {
Column::String(x)
}
}
impl Into<Column> for &String {
fn into(self) -> Column {
Column::String(self.clone())
impl From<&String> for Column {
fn from(x: &String) -> Self {
Column::String(x.clone())
}
}
impl Into<Column> for &str {
fn into(self) -> Column {
Column::String(self.to_string())
impl From<&str> for Column {
fn from(x: &str) -> Self {
Column::String(x.to_string())
}
}

View File

@ -561,9 +561,9 @@ impl From<Value> for UntaggedValue {
}
/// Convert a borrowed Value into a borrowed UntaggedValue
impl<'a> Into<&'a UntaggedValue> for &'a Value {
fn into(self) -> &'a UntaggedValue {
&self.value
impl<'a> From<&'a Value> for &'a UntaggedValue {
fn from(x: &'a Value) -> Self {
&x.value
}
}

View File

@ -14,6 +14,6 @@ where
D: serde::Deserializer<'de>,
{
let x: String = serde::Deserialize::deserialize(deserializer)?;
Ok(BigDecimal::parse_bytes(x.as_bytes(), 10)
.ok_or_else(|| serde::de::Error::custom("expected a bigdecimal"))?)
BigDecimal::parse_bytes(x.as_bytes(), 10)
.ok_or_else(|| serde::de::Error::custom("expected a bigdecimal"))
}

View File

@ -15,6 +15,6 @@ where
{
let x: String = serde::Deserialize::deserialize(deserializer)?;
Ok(BigInt::parse_bytes(x.as_bytes(), 10)
.ok_or_else(|| serde::de::Error::custom("expected a bignum"))?)
BigInt::parse_bytes(x.as_bytes(), 10)
.ok_or_else(|| serde::de::Error::custom("expected a bignum"))
}