Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Dec 17, 2024
1 parent 454dbb5 commit 9a5e414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/recipe/parser/requirements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ impl TryConvertNode<MatchSpec> for RenderedScalarNode {

// if we have a matchspec that is only numbers, and ., we complain and ask the user to add a
// `.*` or `==` in front of it.
let splitted = string.split_whitespace().collect::<Vec<_>>();
if splitted.len() >= 2 {
if splitted[1].chars().all(|c| c.is_numeric() || c == '.') {
let name = splitted[0];
let version = splitted[1];
let rest = splitted[2..].join(" ");
let split_string = string.split_whitespace().collect::<Vec<_>>();
if split_string.len() >= 2 {

Check failure on line 374 in src/recipe/parser/requirements.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | Raw Output: src/recipe/parser/requirements.rs:374:9:e:error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | __END__

Check failure on line 374 in src/recipe/parser/requirements.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | Raw Output: src/recipe/parser/requirements.rs:374:9:e:error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | __END__

Check failure on line 374 in src/recipe/parser/requirements.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | Raw Output: src/recipe/parser/requirements.rs:374:9:e:error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | __END__

Check failure on line 374 in src/recipe/parser/requirements.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | Raw Output: src/recipe/parser/requirements.rs:374:9:e:error: this `if` statement can be collapsed --> src/recipe/parser/requirements.rs:374:9 | 374 | / if split_string.len() >= 2 { 375 | | if split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 376 | | let name = split_string[0]; 377 | | let version = split_string[1]; ... | 392 | | } 393 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if = note: `-D clippy::collapsible-if` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::collapsible_if)]` help: collapse nested if block | 374 ~ if split_string.len() >= 2 && split_string[1].chars().all(|c| c.is_numeric() || c == '.') { 375 + let name = split_string[0]; 376 + let version = split_string[1]; 377 + let rest = split_string[2..].join(" "); 378 + let rest = if rest.is_empty() { 379 + "".to_string() 380 + } else { 381 + format!(" {}", rest) 382 + }; 383 + 384 + return Err(vec![_partialerror!( 385 + *self.span(), 386 + ErrorKind::Other, 387 + label = format!( 388 + "This match spec is ambiguous. Do you mean `{name} =={version}{rest}` or `{name} {version}.*{rest}`?" 389 + ) 390 + )]); 391 + } | __END__
if split_string[1].chars().all(|c| c.is_numeric() || c == '.') {
let name = split_string[0];
let version = split_string[1];
let rest = split_string[2..].join(" ");
let rest = if rest.is_empty() {
"".to_string()
} else {
Expand Down
2 changes: 0 additions & 2 deletions test-data/recipes/race-condition/recipe-python-min.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ package:

requirements:
host:
- python ${{ python_min }}
- python >=${{ python_min }}
- python ${{ python_min }}.*
- python ${{ python_min ~ ".*,<4.0a0" }}
run:
- python ${{ python_min }}
- python >=${{ python_min }}
- python ${{ python_min }}.*
- python ${{ python_min ~ ".*,<4.0a0" }}

0 comments on commit 9a5e414

Please sign in to comment.