mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-23 09:44:22 +03:00
Fix clippy warning
This commit is contained in:
parent
43f4332939
commit
9518d158e8
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user