Unverified Commit 2a3702fe by Enkelmann Committed by GitHub

Fix clippy warnings introduced in Rust 1.75 (#437)

parent de827ccc
......@@ -165,15 +165,13 @@ impl BricksDomain {
for i in 0..long_list.len() {
if empty_bricks_added >= len_diff {
new_list.push(short_list.get(0).unwrap().clone());
new_list.push(short_list[0].clone());
short_list.remove(0);
} else if short_list.is_empty()
|| short_list.get(0).unwrap() != long_list.get(i).unwrap()
{
} else if short_list.is_empty() || &short_list[0] != long_list.get(i).unwrap() {
new_list.push(BrickDomain::get_empty_brick_domain());
empty_bricks_added += 1;
} else {
new_list.push(short_list.get(0).unwrap().clone());
new_list.push(short_list[0].clone());
short_list.remove(0);
}
}
......
......@@ -70,7 +70,7 @@ fn generate_fixpoint_computation<'a>(
// Set the node values for all function entry nodes.
for node in graph.node_indices() {
if let Node::BlkStart(block, sub) = graph[node] {
if let Some(entry_block) = sub.term.blocks.get(0) {
if let Some(entry_block) = sub.term.blocks.first() {
if entry_block.tid == block.tid {
// The node of a function entry point
let calling_convention = project
......
......@@ -512,7 +512,7 @@ pub fn get_entry_nodes_of_subs(graph: &Graph) -> HashMap<Tid, NodeIndex> {
let mut sub_to_entry_node_map: HashMap<Tid, NodeIndex> = HashMap::new();
for node in graph.node_indices() {
if let Node::BlkStart(block, sub) = graph[node] {
if let Some(entry_block) = sub.term.blocks.get(0) {
if let Some(entry_block) = sub.term.blocks.first() {
if block.tid == entry_block.tid {
sub_to_entry_node_map.insert(sub.tid.clone(), node);
}
......
......@@ -305,7 +305,7 @@ impl<'a> PointerInference<'a> {
call: (caller_blk, _caller_sub),
return_: _,
} => {
let call_tid = match caller_blk.term.jmps.get(0) {
let call_tid = match caller_blk.term.jmps.first() {
Some(call) => &call.tid,
_ => continue,
};
......
......@@ -90,7 +90,7 @@ fn journal_sp_value(
/// Returns the tid of the target of the first Jmp::Branch of the provided block.
fn get_first_branch_tid(blk: &Term<Blk>) -> Option<&Tid> {
if let Some(jmp) = blk.term.jmps.get(0) {
if let Some(jmp) = blk.term.jmps.first() {
if let Jmp::Branch(jump_to_blk) = &jmp.term {
return Some(jump_to_blk);
}
......
......@@ -74,7 +74,7 @@ impl<'a, T: AbstractDomain + HasTop + Eq + From<String> + DomainInsertion> Conte
for (node_id, node) in pointer_inference_results.get_graph().node_references() {
match node {
Node::BlkStart(block, sub) => {
if let Some(def) = block.term.defs.get(0) {
if let Some(def) = block.term.defs.first() {
block_start_node_map.insert((def.tid.clone(), sub.tid.clone()), node_id);
block_first_def_set.insert((def.tid.clone(), sub.tid.clone()));
}
......
......@@ -56,7 +56,7 @@ impl<'a, T: AbstractDomain + DomainInsertion + HasTop + Eq + From<String>>
let mut sub_to_entry_blocks_map = HashMap::new();
for sub in project.program.term.subs.values() {
if let Some(entry_block) = sub.term.blocks.get(0) {
if let Some(entry_block) = sub.term.blocks.first() {
sub_to_entry_blocks_map.insert(sub.tid.clone(), entry_block.tid.clone());
}
}
......
......@@ -70,7 +70,7 @@ impl<'a> Context<'a> {
for (node_id, node) in graph.node_references() {
match node {
Node::BlkStart(block, sub) => {
if let Some(def) = block.term.defs.get(0) {
if let Some(def) = block.term.defs.first() {
block_start_node_map.insert((def.tid.clone(), sub.tid.clone()), node_id);
}
}
......
......@@ -158,7 +158,7 @@ pub fn check_system_call_parameter(
if let Some(Arg::Register {
expr: Expression::Var(var),
..
}) = system_symbol.parameters.get(0)
}) = system_symbol.parameters.first()
{
if let Some(value) = source_state.get_variable_to_pointer_map().get(var) {
let contains_string_constant = value.get_absolute_value().is_some();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment