ControlFlowGraph::calculate_difference_all_edges build warning fix. (#1390)

get_edge returns a reference, anyhow CfgEdge does implement the Borrow's trait neither.
This commit is contained in:
David CARLIER 2023-08-02 08:58:49 +01:00 committed by GitHub
parent fc809ccb33
commit f4f55088e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
//! LLVM style control flow graph with information of AFL-style index of the each //! LLVM style control flow graph with information of AFL-style index of the each
//! edges, use together with ``AFLCoverage`` pass having --dump-afl-cfg flag enabled. //! edges, use together with ``AFLCoverage`` pass having --dump-afl-cfg flag enabled.
use core::borrow::Borrow;
use std::{ use std::{
collections::{BinaryHeap, HashMap, HashSet}, collections::{BinaryHeap, HashMap, HashSet},
marker::PhantomData, marker::PhantomData,
@ -313,10 +312,8 @@ where
} }
if let Some(edge_info) = self.get_edge(edge) { if let Some(edge_info) = self.get_edge(edge) {
for successor in &edge_info.successor_edges { for successor in &edge_info.successor_edges {
let successor_info = self let successor_info =
.get_edge(*successor) self.get_edge(*successor).expect("unknown successor added");
.expect("unknown successor added")
.borrow();
let new_distance = distance + successor_info.get_weight(); let new_distance = distance + successor_info.get_weight();
let is_shorter = distances let is_shorter = distances
.get(successor) .get(successor)