Skip to content

Commit 59e7727

Browse files
authored
Merge pull request #68 from Janekdererste/#67_clippy_issues
#67 remove errors pointed out by clippy
2 parents 1599e7c + a8d0043 commit 59e7727

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/simulation/io/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl IONetwork {
146146

147147
// to make via swollow this, it neads an xml tag, as well as a dtd header.
148148
let network_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE network SYSTEM \"http://www.matsim.org/files/dtd/network_v2.dtd\">";
149-
writer.write(network_header.as_ref()).unwrap();
149+
writer.write_all(network_header.as_ref()).unwrap();
150150

151151
// write the actual network
152152
to_writer(writer, self).unwrap();

src/simulation/routing/road_router.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ pub(self) fn find_edge_id_of_outgoing(
235235
next_node: NodeId,
236236
network: &RoutingKitNetwork,
237237
) -> u64 {
238-
//TODO this is marked as unnecessary comparison - why?
239-
assert!(last_out_index - first_out_index >= 0, "No outgoing edges!");
238+
assert!(
239+
last_out_index as i64 - first_out_index as i64 >= 0,
240+
"No outgoing edges!"
241+
);
240242
let mut result = None;
241243
for i in first_out_index..=last_out_index {
242244
if *network.head.get(i).unwrap() == next_node {

src/simulation/simulation.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,14 @@ impl<'sim> Simulation<'sim> {
105105
);
106106

107107
if self.router.is_some() {
108-
if !agent.curr_act().is_interaction() && agent.next_act().is_interaction() {
109-
self.update_walk_leg(&mut agent);
110-
} else if agent.curr_act().is_interaction() && !agent.next_act().is_interaction() {
108+
if (!agent.curr_act().is_interaction() && agent.next_act().is_interaction())
109+
|| (agent.curr_act().is_interaction() && !agent.next_act().is_interaction())
110+
{
111111
self.update_walk_leg(&mut agent);
112112
} else if agent.curr_act().is_interaction() && agent.next_act().is_interaction() {
113113
self.update_main_leg(&mut agent);
114114
} else {
115-
panic!(
116-
"Computing a leg between two interaction activities should never happen."
117-
)
115+
panic!("Computing a leg between two main activities should never happen.")
118116
}
119117
}
120118

0 commit comments

Comments
 (0)