mirror of
https://github.com/nushell/nushell.git
synced 2025-08-03 13:07:56 +02:00
Fix latest clippy warnings (#3049)
This commit is contained in:
@ -10,12 +10,12 @@ pub struct TokenBuilder<T: HasSpan> {
|
||||
contents: Option<Vec<T>>,
|
||||
}
|
||||
|
||||
impl<T> Into<Vec<T>> for TokenBuilder<T>
|
||||
impl<T> From<TokenBuilder<T>> for Vec<T>
|
||||
where
|
||||
T: HasSpan,
|
||||
{
|
||||
fn into(self) -> Vec<T> {
|
||||
self.contents.unwrap_or_else(Vec::new)
|
||||
fn from(x: TokenBuilder<T>) -> Self {
|
||||
x.contents.unwrap_or_else(Vec::new)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2140,7 +2140,7 @@ pub fn parse(
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unit_parse_byte_units() -> Result<(), ParseError> {
|
||||
fn unit_parse_byte_units() {
|
||||
struct TestCase {
|
||||
string: String,
|
||||
value: i64,
|
||||
@ -2275,5 +2275,4 @@ fn unit_parse_byte_units() -> Result<(), ParseError> {
|
||||
)
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ pub fn parse_type_token(type_: &Token) -> (SyntaxShape, Option<ParseError>) {
|
||||
pub(crate) fn parse_rest_name(name_token: &Token) -> Option<ParseError> {
|
||||
return if let TokenContents::Baseline(name) = &name_token.contents {
|
||||
if !name.starts_with("...") {
|
||||
parse_rest_name_err(name_token)
|
||||
Some(parse_rest_name_err(name_token))
|
||||
} else if !name.starts_with("...rest") {
|
||||
Some(ParseError::mismatch(
|
||||
"rest argument name to be 'rest'",
|
||||
@ -197,13 +197,10 @@ pub(crate) fn parse_rest_name(name_token: &Token) -> Option<ParseError> {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
parse_rest_name_err(name_token)
|
||||
Some(parse_rest_name_err(name_token))
|
||||
};
|
||||
|
||||
fn parse_rest_name_err(token: &Token) -> Option<ParseError> {
|
||||
Some(ParseError::mismatch(
|
||||
"...rest",
|
||||
token_to_spanned_string(token),
|
||||
))
|
||||
fn parse_rest_name_err(token: &Token) -> ParseError {
|
||||
ParseError::mismatch("...rest", token_to_spanned_string(token))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user