Skip to content

Commit 34eec21

Browse files
authored
Fix clippy warnings for Rust 1.86 (#1414)
* First batch of fixes * Second batch of fixes * Third batch of fixes * Fourth batch of fixes * Fifth batch of fixes * Last batch of fixes
1 parent 2b8a173 commit 34eec21

25 files changed

+202
-202
lines changed

rustworkx-core/src/bipartite_coloring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ fn rbmg_edge_color(g0: &RegularBipartiteMultiGraph) -> Vec<Matching> {
411411
/// Arguments:
412412
///
413413
/// * `graph` - The graph object to run the algorithm on. The graph is
414-
/// assumed to be bipartite.
414+
/// assumed to be bipartite.
415415
/// * `l_nodes` - The vector containing the "left" nodes of the graph.
416416
/// * `r_nodes` - The vector containing the "right" nodes of the graph.
417417
///

rustworkx-core/src/centrality.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ use rayon_cond::CondIterator;
3939
///
4040
/// * `graph` - The graph object to run the algorithm on
4141
/// * `include_endpoints` - Whether to include the endpoints of paths in the path
42-
/// lengths used to compute the betweenness
42+
/// lengths used to compute the betweenness
4343
/// * `normalized` - Whether to normalize the betweenness scores by the number
44-
/// of distinct paths between all pairs of nodes
44+
/// of distinct paths between all pairs of nodes
4545
/// * `parallel_threshold` - The number of nodes to calculate the betweenness
46-
/// centrality in parallel at, if the number of nodes in `graph` is less
47-
/// than this value it will run in a single thread. A good default to use
48-
/// here if you're not sure is `50` as that was found to be roughly the
49-
/// number of nodes where parallelism improves performance
46+
/// centrality in parallel at, if the number of nodes in `graph` is less
47+
/// than this value it will run in a single thread. A good default to use
48+
/// here if you're not sure is `50` as that was found to be roughly the
49+
/// number of nodes where parallelism improves performance
5050
///
5151
/// # Example
5252
/// ```rust
@@ -147,12 +147,12 @@ where
147147
///
148148
/// * `graph` - The graph object to run the algorithm on
149149
/// * `normalized` - Whether to normalize the betweenness scores by the number
150-
/// of distinct paths between all pairs of nodes
150+
/// of distinct paths between all pairs of nodes
151151
/// * `parallel_threshold` - The number of nodes to calculate the betweenness
152-
/// centrality in parallel at, if the number of nodes in `graph` is less
153-
/// than this value it will run in a single thread. A good default to use
154-
/// here if you're not sure is `50` as that was found to be roughly the
155-
/// number of nodes where parallelism improves performance
152+
/// centrality in parallel at, if the number of nodes in `graph` is less
153+
/// than this value it will run in a single thread. A good default to use
154+
/// here if you're not sure is `50` as that was found to be roughly the
155+
/// number of nodes where parallelism improves performance
156156
///
157157
/// # Example
158158
/// ```rust
@@ -666,12 +666,12 @@ mod test_edge_betweenness_centrality {
666666
///
667667
/// * `graph` - The graph object to run the algorithm on
668668
/// * `weight_fn` - An input callable that will be passed the `EdgeRef` for
669-
/// an edge in the graph and is expected to return a `Result<f64>` of
670-
/// the weight of that edge.
669+
/// an edge in the graph and is expected to return a `Result<f64>` of
670+
/// the weight of that edge.
671671
/// * `max_iter` - The maximum number of iterations in the power method. If
672-
/// set to `None` a default value of 100 is used.
672+
/// set to `None` a default value of 100 is used.
673673
/// * `tol` - The error tolerance used when checking for convergence in the
674-
/// power method. If set to `None` a default value of 1e-6 is used.
674+
/// power method. If set to `None` a default value of 1e-6 is used.
675675
///
676676
/// # Example
677677
/// ```rust
@@ -752,16 +752,16 @@ where
752752
///
753753
/// * `graph` - The graph object to run the algorithm on
754754
/// * `weight_fn` - An input callable that will be passed the `EdgeRef` for
755-
/// an edge in the graph and is expected to return a `Result<f64>` of
756-
/// the weight of that edge.
755+
/// an edge in the graph and is expected to return a `Result<f64>` of
756+
/// the weight of that edge.
757757
/// * `alpha` - Attenuation factor. If set to `None`, a default value of 0.1 is used.
758758
/// * `beta_map` - Immediate neighbourhood weights. Must contain all node indices or be `None`.
759759
/// * `beta_scalar` - Immediate neighbourhood scalar that replaces `beta_map` in case `beta_map` is None.
760-
/// Defaults to 1.0 in case `None` is provided.
760+
/// Defaults to 1.0 in case `None` is provided.
761761
/// * `max_iter` - The maximum number of iterations in the power method. If
762-
/// set to `None` a default value of 100 is used.
762+
/// set to `None` a default value of 100 is used.
763763
/// * `tol` - The error tolerance used when checking for convergence in the
764-
/// power method. If set to `None` a default value of 1e-6 is used.
764+
/// power method. If set to `None` a default value of 1e-6 is used.
765765
///
766766
/// # Example
767767
/// ```rust
@@ -1170,9 +1170,9 @@ where
11701170
/// * `graph` - The graph object to run the algorithm on
11711171
/// * `wf_improved` - If `true`, scale by the fraction of nodes reachable.
11721172
/// * `weight_fn` - An input callable that will be passed the
1173-
/// `ReversedEdgeReference<<G as IntoEdgeReferences>::EdgeRef>` for
1174-
/// an edge in the graph and is expected to return a `f64` of
1175-
/// the weight of that edge.
1173+
/// `ReversedEdgeReference<<G as IntoEdgeReferences>::EdgeRef>` for
1174+
/// an edge in the graph and is expected to return a `f64` of
1175+
/// the weight of that edge.
11761176
///
11771177
/// # Example
11781178
///

rustworkx-core/src/coloring.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ where
402402
///
403403
/// * `graph` - The graph object to run the algorithm on
404404
/// * `preset_color_fn` - A callback function that will receive the node identifier
405-
/// for each node in the graph and is expected to return an `Option<usize>`
406-
/// (wrapped in a `Result`) that is `None` if the node has no preset and
407-
/// the usize represents the preset color.
405+
/// for each node in the graph and is expected to return an `Option<usize>`
406+
/// (wrapped in a `Result`) that is `None` if the node has no preset and
407+
/// the usize represents the preset color.
408408
///
409409
/// # Example
410410
/// ```rust
@@ -468,9 +468,9 @@ where
468468
///
469469
/// * `graph` - The graph object to run the algorithm on.
470470
/// * `preset_color_fn` - A callback function that will receive the node identifier
471-
/// for each node in the graph and is expected to return an `Option<usize>`
472-
/// (wrapped in a `Result`) that is `None` if the node has no preset and
473-
/// the usize represents the preset color.
471+
/// for each node in the graph and is expected to return an `Option<usize>`
472+
/// (wrapped in a `Result`) that is `None` if the node has no preset and
473+
/// the usize represents the preset color.
474474
/// * `strategy` - The greedy strategy used by the algorithm.
475475
///
476476
/// # Example
@@ -581,9 +581,9 @@ where
581581
///
582582
/// * `graph` - The graph object to run the algorithm on.
583583
/// * `preset_color_fn` - A callback function that will receive the edge identifier
584-
/// for each edge in the graph and is expected to return an `Option<usize>`
585-
/// (wrapped in a `Result`) that is `None` if the edge has no preset and
586-
/// the usize represents the preset color.
584+
/// for each edge in the graph and is expected to return an `Option<usize>`
585+
/// (wrapped in a `Result`) that is `None` if the edge has no preset and
586+
/// the usize represents the preset color.
587587
/// * `strategy` - The greedy strategy used by the algorithm.
588588
///
589589
/// # Example

rustworkx-core/src/connectivity/cycle_basis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::hash::Hash;
3434
///
3535
/// * `graph` - The graph in which to find the basis.
3636
/// * `root` - Optional node index for starting the basis search. If not
37-
/// specified, an arbitrary node is chosen.
37+
/// specified, an arbitrary node is chosen.
3838
///
3939
/// # Example
4040
/// ```rust

rustworkx-core/src/connectivity/find_cycle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::hash::Hash;
2525
///
2626
/// * `graph` - The directed graph in which to find the first cycle.
2727
/// * `source` - Optional node index for starting the search. If not specified,
28-
/// an arbitrary node is chosen to start the search.
28+
/// an arbitrary node is chosen to start the search.
2929
///
3030
/// # Example
3131
/// ```rust

rustworkx-core/src/dag_algo.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ impl<E: Error> Error for TopologicalSortError<E> {}
8080
///
8181
/// * `dag`: The DAG to get the topological sorted nodes from
8282
/// * `key`: A function that gets passed a single argument, the node id from
83-
/// `dag` and is expected to return a key which will be used for
84-
/// resolving ties in the sorting order.
83+
/// `dag` and is expected to return a key which will be used for
84+
/// resolving ties in the sorting order.
8585
/// * `reverse`: If `false`, perform a regular topological ordering. If `true`,
86-
/// return the lexicographical topological order that would have been found
87-
/// if all the edges in the graph were reversed. This does not affect the
88-
/// comparisons from the `key`.
86+
/// return the lexicographical topological order that would have been found
87+
/// if all the edges in the graph were reversed. This does not affect the
88+
/// comparisons from the `key`.
8989
/// * `initial`: If given, the initial node indices to start the topological
90-
/// ordering from. If not given, the topological ordering will certainly contain every node in
91-
/// the graph. If given, only the `initial` nodes and nodes that are dominated by the
92-
/// `initial` set will be in the ordering. Notably, any node that has a natural in degree of
93-
/// zero will not be in the output ordering if `initial` is given and the zero-in-degree node
94-
/// is not in it. It is not supported to give an `initial` set where the nodes have even
95-
/// a partial topological order between themselves and `None` will be returned in this case
90+
/// ordering from. If not given, the topological ordering will certainly contain every node in
91+
/// the graph. If given, only the `initial` nodes and nodes that are dominated by the
92+
/// `initial` set will be in the ordering. Notably, any node that has a natural in degree of
93+
/// zero will not be in the output ordering if `initial` is given and the zero-in-degree node
94+
/// is not in it. It is not supported to give an `initial` set where the nodes have even
95+
/// a partial topological order between themselves and `None` will be returned in this case
9696
///
9797
/// # Returns
9898
///
@@ -348,7 +348,7 @@ where
348348
///
349349
/// * `graph` - The graph to get the layers from
350350
/// * `first_layer` - A list of node ids for the first layer. This
351-
/// will be the first layer in the output
351+
/// will be the first layer in the output
352352
///
353353
/// Will `panic!` if a provided node is not in the graph.
354354
/// ```
@@ -503,20 +503,20 @@ where
503503
///
504504
/// * `graph`: The DAG to find bicolor runs in
505505
/// * `filter_fn`: The filter function to use for matching nodes. It takes
506-
/// in one argument, the node data payload/weight object, and will return a
507-
/// boolean whether the node matches the conditions or not.
508-
/// If it returns ``true``, it will continue the bicolor chain.
509-
/// If it returns ``false``, it will stop the bicolor chain.
510-
/// If it returns ``None`` it will skip that node.
506+
/// in one argument, the node data payload/weight object, and will return a
507+
/// boolean whether the node matches the conditions or not.
508+
/// If it returns ``true``, it will continue the bicolor chain.
509+
/// If it returns ``false``, it will stop the bicolor chain.
510+
/// If it returns ``None`` it will skip that node.
511511
/// * `color_fn`: The function that gives the color of the edge. It takes
512-
/// in one argument, the edge data payload/weight object, and will
513-
/// return a non-negative integer, the edge color. If the color is None,
514-
/// the edge is ignored.
512+
/// in one argument, the edge data payload/weight object, and will
513+
/// return a non-negative integer, the edge color. If the color is None,
514+
/// the edge is ignored.
515515
///
516516
/// # Returns:
517517
///
518518
/// * `Vec<Vec<G::NodeId>>`: a list of groups with exactly two edge colors, where each group
519-
/// is a list of node data payload/weight for the nodes in the bicolor run
519+
/// is a list of node data payload/weight for the nodes in the bicolor run
520520
/// * `None` if a cycle is found in the graph
521521
/// * Raises an error if found computing the bicolor runs
522522
///
@@ -665,9 +665,9 @@ where
665665
///
666666
/// * `graph`: The DAG to collect runs from
667667
/// * `include_node_fn`: A filter function used for matching nodes. It takes
668-
/// in one argument, the node data payload/weight object, and returns a
669-
/// boolean whether the node matches the conditions or not.
670-
/// If it returns ``false``, the node will be skipped, cutting the run it's part of.
668+
/// in one argument, the node data payload/weight object, and returns a
669+
/// boolean whether the node matches the conditions or not.
670+
/// If it returns ``false``, the node will be skipped, cutting the run it's part of.
671671
///
672672
/// # Returns:
673673
///

rustworkx-core/src/generators/barbell_graph.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ use crate::utils::pairwise;
2828
/// Arguments:
2929
///
3030
/// * `num_mesh_nodes` - The number of nodes to generate the mesh graph
31-
/// with. Node weights will be None if this is specified. If both
32-
/// `num_mesh_nodes` and `mesh_weights` are set, this will be ignored and
33-
/// `mesh_weights` will be used.
31+
/// with. Node weights will be None if this is specified. If both
32+
/// `num_mesh_nodes` and `mesh_weights` are set, this will be ignored and
33+
/// `mesh_weights` will be used.
3434
/// * `num_path_nodes` - The number of nodes to generate the path
35-
/// with. Node weights will be None if this is specified. If both
36-
/// `num_path_nodes` and `path_weights` are set, this will be ignored and
37-
/// `path_weights` will be used.
35+
/// with. Node weights will be None if this is specified. If both
36+
/// `num_path_nodes` and `path_weights` are set, this will be ignored and
37+
/// `path_weights` will be used.
3838
/// * `mesh_weights` - A list of node weights for the mesh graph. If both
39-
/// `num_mesh_nodes` and `mesh_weights` are set, `num_mesh_nodes` will
40-
/// be ignored and `mesh_weights` will be used.
39+
/// `num_mesh_nodes` and `mesh_weights` are set, `num_mesh_nodes` will
40+
/// be ignored and `mesh_weights` will be used.
4141
/// * `path_weights` - A list of node weights for the path. If both
42-
/// `num_path_nodes` and `path_weights` are set, `num_path_nodes` will
43-
/// be ignored and `path_weights` will be used.
42+
/// `num_path_nodes` and `path_weights` are set, `num_path_nodes` will
43+
/// be ignored and `path_weights` will be used.
4444
/// * `default_node_weight` - A callable that will return the weight to use
45-
/// for newly created nodes. This is ignored if node weights are specified.
45+
/// for newly created nodes. This is ignored if node weights are specified.
4646
/// * `default_edge_weight` - A callable that will return the weight object
47-
/// to use for newly created edges.
47+
/// to use for newly created edges.
4848
///
4949
/// # Example
5050
/// ```rust

rustworkx-core/src/generators/binomial_tree_graph.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ use super::InvalidInputError;
2121
///
2222
/// * `order` - The order of the binomial tree.
2323
/// * `weights` - A `Vec` of node weight objects. If the number of weights is
24-
/// less than 2**order, extra nodes with None will be appended.
24+
/// less than 2**order, extra nodes with None will be appended.
2525
/// * `default_node_weight` - A callable that will return the weight to use
26-
/// for newly created nodes. This is ignored if `weights` is specified.
26+
/// for newly created nodes. This is ignored if `weights` is specified.
2727
/// * `default_edge_weight` - A callable that will return the weight object
28-
/// to use for newly created edges.
28+
/// to use for newly created edges.
2929
/// * `bidirectional` - Whether edges are added bidirectionally. If set to
30-
/// `true` then for any edge `(u, v)` an edge `(v, u)` will also be added.
31-
/// If the graph is undirected this will result in a parallel edge.
30+
/// `true` then for any edge `(u, v)` an edge `(v, u)` will also be added.
31+
/// If the graph is undirected this will result in a parallel edge.
3232
///
3333
/// # Example
3434
/// ```rust

rustworkx-core/src/generators/complete_graph.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ use super::InvalidInputError;
2121
/// Arguments:
2222
///
2323
/// * `num_nodes` - The number of nodes to create a complete graph for. Either this or
24-
/// `weights` must be specified. If both this and `weights` are specified, `weights`
25-
/// will take priority and this argument will be ignored
24+
/// `weights` must be specified. If both this and `weights` are specified, `weights`
25+
/// will take priority and this argument will be ignored
2626
/// * `weights` - A `Vec` of node weight objects.
2727
/// * `default_node_weight` - A callable that will return the weight to use
28-
/// for newly created nodes. This is ignored if `weights` is specified.
28+
/// for newly created nodes. This is ignored if `weights` is specified.
2929
/// * `default_edge_weight` - A callable that will return the weight object
30-
/// to use for newly created edges.
30+
/// to use for newly created edges.
3131
///
3232
/// # Example
3333
/// ```rust

rustworkx-core/src/generators/cycle_graph.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ use super::InvalidInputError;
2121
/// Arguments:
2222
///
2323
/// * `num_nodes` - The number of nodes to create a cycle graph for. Either this or
24-
/// `weights` must be specified. If both this and `weights` are specified, `weights`
25-
/// will take priority and this argument will be ignored.
24+
/// `weights` must be specified. If both this and `weights` are specified, `weights`
25+
/// will take priority and this argument will be ignored.
2626
/// * `weights` - A `Vec` of node weight objects.
2727
/// * `default_node_weight` - A callable that will return the weight to use
28-
/// for newly created nodes. This is ignored if `weights` is specified.
28+
/// for newly created nodes. This is ignored if `weights` is specified.
2929
/// * `default_edge_weight` - A callable that will return the weight object
30-
/// to use for newly created edges.
30+
/// to use for newly created edges.
3131
/// * `bidirectional` - Whether edges are added bidirectionally. If set to
32-
/// `true` then for any edge `(u, v)` an edge `(v, u)` will also be added.
33-
/// If the graph is undirected this will result in a parallel edge.
32+
/// `true` then for any edge `(u, v)` an edge `(v, u)` will also be added.
33+
/// If the graph is undirected this will result in a parallel edge.
3434
///
3535
/// # Example
3636
/// ```rust

0 commit comments

Comments
 (0)