-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Summary
Original output too long so I just get some of it to paste here. Please refers to https://github.com/Apich-Organization/rssn to see the full project code if needed.
Quote 01:
'''
The following errors were reported:
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> src\symbolic\graph_algorithms.rs:1319:21
|
1319 | contract_blossom::(
| ^^^^^^^^^^^^^^^^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> src\symbolic\graph_algorithms.rs:1375:15
|
1375 | pub(crate) fn contract_blossom(
| ^^^^^^^^^^^^^^^^
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> src\symbolic\graph_algorithms.rs:1329:21
|
1329 | contract_blossom::(
| ^^^^^^^^^^^^^^^^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> src\symbolic\graph_algorithms.rs:1375:15
|
1375 | pub(crate) fn contract_blossom(
| ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try rustc --explain E0107
.
Original diagnostics will follow.
'''
Quote 02:
'''
warning: this function has too many arguments (8/7)
--> src\symbolic\graph_algorithms.rs:177:1
|
177 | / pub(crate) fn tarjan_scc_util<V: Eq + std::hash::Hash + Clone + std::fmt::Debug>(
178 | | graph: &Graph,
179 | | u: usize,
180 | | time: &mut usize,
... |
185 | | scc: &mut Vec<Vec>,
186 | | ) {
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: #[warn(clippy::too_many_arguments)]
implied by #[warn(clippy::all)]
warning: this if
statement can be collapsed
--> src\symbolic\graph_algorithms.rs:240:13
|
240 | / ... if !visited.contains(&node_id) {
241 | | ... if has_cycle_directed_util(graph, node_id, &mut visited, &mut recursion_stack) {
242 | | ... return true;
243 | | ... }
244 | | ... }
| |_______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: #[warn(clippy::collapsible_if)]
implied by #[warn(clippy::all)]
help: collapse nested if block
|
240 ~ if !visited.contains(&node_id)
241 ~ && has_cycle_directed_util(graph, node_id, &mut visited, &mut recursion_stack) {
242 | return true;
243 ~ }
|
warning: this if
statement can be collapsed
--> src\symbolic\graph_algorithms.rs:248:13
|
248 | / if !visited.contains(&node_id) {
249 | | if has_cycle_undirected_util(graph, node_id, &mut visited, None) {
250 | | return true;
251 | | }
252 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
248 ~ if !visited.contains(&node_id)
249 ~ && has_cycle_undirected_util(graph, node_id, &mut visited, None) {
250 | return true;
251 ~ }
|
warning: this function has too many arguments (9/7)
--> src\symbolic\graph_algorithms.rs:342:1
|
342 | / pub(crate) fn b_and_ap_util<V: Eq + std::hash::Hash + Clone + std::fmt::Debug>(
343 | | graph: &Graph,
344 | | u: usize,
345 | | parent: Option,
... |
351 | | ap: &mut HashSet,
352 | | ) {
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
warning: the loop variable u
is used to index residual_capacity
--> src\symbolic\graph_algorithms.rs:489:14
|
489 | for u in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
489 - for u in 0..n {
489 + for (u, ) in residual_capacity.iter_mut().enumerate().take(n) {
|
warning: writing &Vec
instead of &[_]
involves a new object where a slice will do
--> src\symbolic\graph_algorithms.rs:525:15
|
525 | capacity: &Vec<Vec>,
| ^^^^^^^^^^^^^^ help: change this to: &[Vec<f64>]
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: #[warn(clippy::ptr_arg)]
implied by #[warn(clippy::all)]
warning: the loop variable u
is used to index residual_capacity
--> src\symbolic\graph_algorithms.rs:573:14
|
573 | for u in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
573 - for u in 0..n {
573 + for (u, ) in residual_capacity.iter_mut().enumerate().take(n) {
|
warning: writing &Vec
instead of &[_]
involves a new object where a slice will do
--> src\symbolic\graph_algorithms.rs:608:15
|
608 | capacity: &Vec<Vec>,
| ^^^^^^^^^^^^^^ help: change this to: &[Vec<f64>]
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
warning: writing &mut Vec
instead of &mut [_]
involves a new object where a slice will do
--> src\symbolic\graph_algorithms.rs:611:12
|
611 | level: &mut Vec,
| ^^^^^^^^^^^^^ help: change this to: &mut [i32]
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
warning: needless use of for_each
--> src\symbolic\graph_algorithms.rs:613:5
|
613 | level.iter_mut().for_each(|l| *l = -1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: for l in level.iter_mut() { *l = -1; }
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
warning: very complex type used. Consider factoring parts into type
definitions
--> src\symbolic\graph_algorithms.rs:679:6
|
679 | ) -> Result<(HashMap<usize, f64>, HashMap<usize, Option>), String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
warning: the loop variable i
is used to index partition
--> src\symbolic\graph_algorithms.rs:872:14
|
872 | for i in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
872 - for i in 0..n {
872 + for (i, ) in partition.iter().enumerate().take(n) {
|
warning: the loop variable i
is used to index in_degree
--> src\symbolic\graph_algorithms.rs:983:14
|
983 | for i in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
983 - for i in 0..n {
983 + for (i, ) in in_degree.iter_mut().enumerate().take(n) {
|
warning: the loop variable i
is used to index partition
--> src\symbolic\graph_algorithms.rs:1070:14
|
1070 | for i in 0..partition.len() {
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1070 - for i in 0..partition.len() {
1070 + for (i, ) in partition.iter().enumerate() {
|
warning: used cloned
where copied
could be used instead
--> src\symbolic\graph_algorithms.rs:1083:68
|
1083 | let unmatched_u: Vec<_> = u_nodes.difference(&matched_nodes_u).cloned().collect();
| ^^^^^^ help: try: copied
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
warning: the loop variable i
is used to index partition
--> src\symbolic\graph_algorithms.rs:1113:14
|
1113 | for i in 0..partition.len() {
| ^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1113 - for i in 0..partition.len() {
1113 + for (i, ) in partition.iter().enumerate() {
|
warning: the loop variable i
is used to index partition
--> src\symbolic\graph_algorithms.rs:1139:14
|
1139 | for i in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1139 - for i in 0..n {
1139 + for (i, ) in partition.iter().enumerate().take(n) {
|
warning: this if
statement can be collapsed
--> src\symbolic\graph_algorithms.rs:1152:13
|
1152 | / if pair_u[u].is_none() {
1153 | | if hopcroft_karp_dfs(graph, u, &mut pair_u, &mut pair_v, &mut dist) {
1154 | | matching += 1;
1155 | | }
1156 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
1152 ~ if pair_u[u].is_none()
1153 ~ && hopcroft_karp_dfs(graph, u, &mut pair_u, &mut pair_v, &mut dist) {
1154 | matching += 1;
1155 ~ }
|
warning: the loop variable u
is used to index pair_u
--> src\symbolic\graph_algorithms.rs:1161:14
|
1161 | for u in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1161 - for u in 0..n {
1161 + for (u, ) in pair_u.iter().enumerate().take(n) {
|
warning: this if
statement can be collapsed
--> src\symbolic\graph_algorithms.rs:1218:21
|
1218 | / if dist[*next_u] == dist[u] + 1 {
1219 | | if hopcroft_karp_dfs(graph, *next_u, pair_u, pair_v, dist) {
1220 | | pair_v[v] = Some(u);
1221 | | pair_u[u] = Some(v);
... |
1224 | | }
| |_____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: collapse nested if block
|
1218 ~ if dist[*next_u] == dist[u] + 1
1219 ~ && hopcroft_karp_dfs(graph, *next_u, pair_u, pair_v, dist) {
1220 | pair_v[v] = Some(u);
1221 | pair_u[u] = Some(v);
1222 | return true;
1223 ~ }
|
warning: the loop variable u
is used to index matching
--> src\symbolic\graph_algorithms.rs:1273:14
|
1273 | for u in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1273 - for u in 0..n {
1273 + for (u, ) in matching.iter().enumerate().take(n) {
|
warning: type parameter V
goes unused in function definition
--> src\symbolic\graph_algorithms.rs:1379:31
|
1379 | pub(crate) fn contract_blossom<V: Eq + std::hash::Hash + Clone + std::fmt::Debug>(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the parameter
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_type_parameters
= note: #[warn(clippy::extra_unused_type_parameters)]
implied by #[warn(clippy::all)]
warning: this function has too many arguments (8/7)
--> src\symbolic\graph_algorithms.rs:1379:1
|
1379 | / pub(crate) fn contract_blossom<V: Eq + std::hash::Hash + Clone + std::fmt::Debug>(
1380 | | base: usize,
1381 | | mut u: usize,
1382 | | v: usize,
... |
1387 | | matching: &[Option],
1388 | | ) {
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
warning: writing &mut Vec
instead of &mut [_]
involves a new object where a slice will do
--> src\symbolic\graph_algorithms.rs:1384:12
|
1384 | level: &mut Vec,
| ^^^^^^^^^^^^^ help: change this to: &mut [i32]
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
warning: writing &mut Vec
instead of &mut [_]
involves a new object where a slice will do
--> src\symbolic\graph_algorithms.rs:1386:13
|
1386 | parent: &mut Vec<Option>,
| ^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: &mut [Option<usize>]
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
warning: usage of contains_key
followed by insert
on a HashMap
--> src\symbolic\graph_algorithms.rs:1442:17
|
1442 | / if !distances.contains_key(&v) {
1443 | | distances.insert(v, u_dist + 1);
1444 | | predecessors.insert(v, Some(u));
1445 | | queue.push_back(v);
1446 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry
= note: #[warn(clippy::map_entry)]
implied by #[warn(clippy::all)]
help: try
|
1442 ~ if let std::collections::hash_map::Entry::Vacant(e) = distances.entry(v) {
1443 + e.insert(u_dist + 1);
1444 + predecessors.insert(v, Some(u));
1445 + queue.push_back(v);
1446 + }
|
warning: used cloned
where copied
could be used instead
--> src\symbolic\graph_algorithms.rs:1453:60
|
1453 | result.insert(node, (dist, predecessors.get(&node).cloned().flatten()));
| ^^^^^^ help: try: copied
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
warning: redundant closure
--> src\symbolic\graph_algorithms.rs:1492:27
|
1492 | .and_then(|d| as_f64(d))
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: as_f64
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: #[warn(clippy::redundant_closure)]
implied by #[warn(clippy::all)]
warning: redundant closure
--> src\symbolic\graph_algorithms.rs:1507:35
|
1507 | .and_then(|d| as_f64(d))
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: as_f64
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
warning: used cloned
where copied
could be used instead
--> src\symbolic\graph_algorithms.rs:1522:49
|
1522 | result.insert(node, (d, prev.get(&node).cloned().flatten()));
| ^^^^^^ help: try: copied
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
warning: the loop variable i
is used to index dist
--> src\symbolic\graph_algorithms.rs:1542:14
|
1542 | for i in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1542 - for i in 0..n {
1542 + for (i, ) in dist.iter_mut().enumerate().take(n) {
|
warning: the loop variable u
is used to index dist
--> src\symbolic\graph_algorithms.rs:1546:14
|
1546 | for u in 0..n {
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
help: consider using an iterator and enumerate()
|
1546 - for u in 0..n {
1546 + for (u, ) in dist.iter_mut().enumerate().take(n) {
|
'''
(I am fixing up these Clippy warnings in this projects and it seems that symbolic\graph_algorithms.rs to be the most problematic one. Commit hash: 2be346d176042b502a01285b04b654229663d7e7.)
Reproducer
I tried this code:
cargo clippy --fix --lib -p rssn
I expected to see this happen:
73 warnings fixed
Instead, this happened:
An error occurred.
'''bash
warning: failed to automatically apply fixes suggested by rustc to crate rssn
after fixes were automatically applied the compiler reported errors within these files:
- src\symbolic\graph_algorithms.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the --broken-code
flag
The following errors were reported:
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> src\symbolic\graph_algorithms.rs:1319:21
|
1319 | contract_blossom::(
| ^^^^^^^^^^^^^^^^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> src\symbolic\graph_algorithms.rs:1375:15
|
1375 | pub(crate) fn contract_blossom(
| ^^^^^^^^^^^^^^^^
error[E0107]: function takes 0 generic arguments but 1 generic argument was supplied
--> src\symbolic\graph_algorithms.rs:1329:21
|
1329 | contract_blossom::(
| ^^^^^^^^^^^^^^^^----- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: function defined here, with 0 generic parameters
--> src\symbolic\graph_algorithms.rs:1375:15
|
1375 | pub(crate) fn contract_blossom(
| ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try rustc --explain E0107
.
Original diagnostics will follow.
'''
*.rs files not supported so I cannot paste the code here.
Version
rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-pc-windows-msvc
release: 1.89.0
LLVM version: 20.1.7
Additional Labels
@rustbot label compiler-reported-errors-after-fix