Fix clippy warning

This commit is contained in:
Fabrice Reix 2021-01-05 08:18:08 +01:00
parent 43f4332939
commit 9518d158e8
7 changed files with 8 additions and 8 deletions

View File

@ -453,7 +453,7 @@ impl Client {
}
let response_code = self.handle.response_code().unwrap();
if response_code < 300 || response_code >= 400 {
if !(300..400).contains(&response_code) {
return None;
}

View File

@ -74,7 +74,7 @@ fn execute(
.split(&contents)
.map(|l| l.to_string())
.collect();
let optional_filename = if filename == "" {
let optional_filename = if filename.is_empty() {
None
} else {
Some(filename.to_string())

View File

@ -40,7 +40,7 @@ pub fn parse(reader: &mut Reader) -> Vec<u8> {
let mut buf = vec![]; // base64 text
loop {
let pad = padding(reader);
if pad != "" {
if !pad.is_empty() {
break;
}
let save = reader.state.clone();

View File

@ -59,7 +59,7 @@ pub fn parse2(reader: &mut Reader) -> ParseResult<'static, Expr> {
fn variable_name(reader: &mut Reader) -> ParseResult<'static, Variable> {
let start = reader.state.clone();
let name = reader.read_while(|c| c.is_alphanumeric() || *c == '_');
if name == "" {
if name.is_empty() {
return Err(Error {
pos: start.pos,
recoverable: false,

View File

@ -760,7 +760,7 @@ impl Tokenizable for LineTerminator {
impl Tokenizable for Whitespace {
fn tokenize(&self) -> Vec<Token> {
let mut tokens: Vec<Token> = vec![];
if self.value != "" {
if !self.value.is_empty() {
tokens.push(Token::Whitespace(self.clone().value));
}
tokens

View File

@ -685,7 +685,7 @@ impl Lintable<LineTerminator> for LineTerminator {
}
}
None => {
if self.space0.value != "" {
if !self.space0.value.is_empty() {
errors.push(Error {
source_info: self.clone().space0.source_info,
inner: LinterError::UnneccessarySpace {},
@ -709,7 +709,7 @@ impl Lintable<LineTerminator> for LineTerminator {
Some(comment) => Some(comment.lint()),
};
let newline = Whitespace {
value: if self.newline.value == "" {
value: if self.newline.value.is_empty() {
"".to_string()
} else {
"\n".to_string()

View File

@ -158,7 +158,7 @@ fn main() {
.collect();
let lines: Vec<String> = lines.iter().map(|s| (*s).to_string()).collect();
let optional_filename = if filename == "" {
let optional_filename = if filename.is_empty() {
None
} else {
Some(filename.to_string())