Skip to content

Commit d314b0b

Browse files
authored
Merge pull request #1207 from CodingThrust/rust-2024-edition
Migrate workspace to Rust 2024 edition
2 parents 37e381c + 17dfcc1 commit d314b0b

587 files changed

Lines changed: 3508 additions & 2607 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ members = [
1010
[package]
1111
name = "problemreductions"
1212
version = "0.6.0"
13-
edition = "2021"
13+
edition = "2024"
14+
rust-version = "1.88"
1415
description = "A library for reducing NP-hard problems"
1516
license = "MIT"
1617
repository = "https://github.com/CodingThrust/problem-reductions"

‎benches/solver_benchmarks.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Benchmarks for the BruteForce solver on various problem types.
22
3-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
3+
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
44
use problemreductions::models::formula::*;
55
use problemreductions::models::graph::*;
66
use problemreductions::models::misc::*;

‎examples/detect_isolated_problems.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//!
33
//! Run with: `cargo run --example detect_isolated_problems`
44
5-
use problemreductions::rules::analysis::check_connectivity;
65
use problemreductions::rules::ReductionGraph;
6+
use problemreductions::rules::analysis::check_connectivity;
77

88
fn main() {
99
let graph = ReductionGraph::new();

‎examples/detect_unreachable_from_3sat.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//!
88
//! Run with: `cargo run --example detect_unreachable_from_3sat`
99
10-
use problemreductions::rules::analysis::{check_reachability_from_3sat, UnreachableReason};
1110
use problemreductions::rules::ReductionGraph;
11+
use problemreductions::rules::analysis::{UnreachableReason, check_reachability_from_3sat};
1212

1313
fn main() {
1414
let graph = ReductionGraph::new();

‎examples/export_mapping_stages.rs‎

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
1010
use problemreductions::rules::unitdiskmapping::{
1111
_internal::{
12-
create_copylines, mis_overhead_copyline, mis_overhead_copyline_triangular, CopyLine,
13-
MappingGrid,
12+
CopyLine, MappingGrid, create_copylines, mis_overhead_copyline,
13+
mis_overhead_copyline_triangular,
1414
},
1515
ksg, triangular,
1616
};
@@ -110,21 +110,21 @@ fn extract_grid_nodes(grid: &MappingGrid) -> Vec<GridNodeExport> {
110110
let (rows, cols) = grid.size();
111111
for r in 0..rows {
112112
for c in 0..cols {
113-
if let Some(cell) = grid.get(r, c) {
114-
if !cell.is_empty() {
115-
let state = match cell {
116-
CellState::Occupied { .. } => "O",
117-
CellState::Doubled { .. } => "D",
118-
CellState::Connected { .. } => "C",
119-
CellState::Empty => ".",
120-
};
121-
nodes.push(GridNodeExport {
122-
row: r as i64, // 0-indexed - DO NOT change!
123-
col: c as i64, // 0-indexed - DO NOT change!
124-
weight: cell.weight(),
125-
state: state.to_string(),
126-
});
127-
}
113+
if let Some(cell) = grid.get(r, c)
114+
&& !cell.is_empty()
115+
{
116+
let state = match cell {
117+
CellState::Occupied { .. } => "O",
118+
CellState::Doubled { .. } => "D",
119+
CellState::Connected { .. } => "C",
120+
CellState::Empty => ".",
121+
};
122+
nodes.push(GridNodeExport {
123+
row: r as i64, // 0-indexed - DO NOT change!
124+
col: c as i64, // 0-indexed - DO NOT change!
125+
weight: cell.weight(),
126+
state: state.to_string(),
127+
});
128128
}
129129
}
130130
}
@@ -159,21 +159,20 @@ fn crossat_triangular(
159159

160160
fn get_vertex_order_from_julia(graph_name: &str) -> Option<Vec<usize>> {
161161
let path = format!("tests/data/{}_triangular_trace.json", graph_name);
162-
if let Ok(content) = fs::read_to_string(&path) {
163-
if let Ok(data) = serde_json::from_str::<serde_json::Value>(&content) {
164-
if let Some(copy_lines) = data["copy_lines"].as_array() {
165-
let mut lines: Vec<_> = copy_lines
166-
.iter()
167-
.filter_map(|cl| {
168-
let vertex = cl["vertex"].as_u64()? as usize;
169-
let vslot = cl["vslot"].as_u64()? as usize;
170-
Some((vertex - 1, vslot)) // Convert to 0-indexed
171-
})
172-
.collect();
173-
lines.sort_by_key(|(_, vslot)| *vslot);
174-
return Some(lines.into_iter().map(|(v, _)| v).collect());
175-
}
176-
}
162+
if let Ok(content) = fs::read_to_string(&path)
163+
&& let Ok(data) = serde_json::from_str::<serde_json::Value>(&content)
164+
&& let Some(copy_lines) = data["copy_lines"].as_array()
165+
{
166+
let mut lines: Vec<_> = copy_lines
167+
.iter()
168+
.filter_map(|cl| {
169+
let vertex = cl["vertex"].as_u64()? as usize;
170+
let vslot = cl["vslot"].as_u64()? as usize;
171+
Some((vertex - 1, vslot)) // Convert to 0-indexed
172+
})
173+
.collect();
174+
lines.sort_by_key(|(_, vslot)| *vslot);
175+
return Some(lines.into_iter().map(|(v, _)| v).collect());
177176
}
178177
None
179178
}

‎examples/export_petersen_mapping.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//! - `docs/paper/static/petersen_square_unweighted.json` - Unweighted King's subgraph
2929
//! - `docs/paper/static/petersen_triangular.json` - Weighted triangular lattice
3030
31-
use problemreductions::rules::unitdiskmapping::{ksg, triangular, MappingResult};
31+
use problemreductions::rules::unitdiskmapping::{MappingResult, ksg, triangular};
3232
use serde::Serialize;
3333
use std::fs;
3434
use std::path::Path;

‎examples/export_schemas.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! Run with: `cargo run --example export_schemas [output_path]`
44
5-
use problemreductions::registry::{collect_schemas, ProblemSchemaEntry};
5+
use problemreductions::registry::{ProblemSchemaEntry, collect_schemas};
66
use std::path::{Path, PathBuf};
77

88
pub fn run(output_path: &Path) {

‎examples/polynomial_compare_audit.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Each endpoint group is one generic batch, including every nonzero field certificate.
66
//!
77
//! cargo run --release --example polynomial_compare_audit
8-
use problemreductions::poly_compare::{compare_all, Direction, Profile, Reason, Verdict};
8+
use problemreductions::poly_compare::{Direction, Profile, Reason, Verdict, compare_all};
99
use problemreductions::rules::{ReductionGraph, ReductionPath, ReductionStep};
1010
use std::collections::BTreeMap;
1111
use std::time::Instant;

‎problemreductions-cli/Cargo.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
22
name = "problemreductions-cli"
33
version = "0.6.0"
4-
edition = "2021"
4+
edition = "2024"
5+
rust-version = "1.88"
56
description = "CLI tool for exploring NP-hard problem reductions"
67
license = "MIT"
78
repository = "https://github.com/CodingThrust/problem-reductions"

‎problemreductions-cli/src/bin/pred_sym.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::{Parser, Subcommand};
2-
use problemreductions::{big_o_normal_form, evaluate_approximate, Expr, ProblemParameters};
2+
use problemreductions::{Expr, ProblemParameters, big_o_normal_form, evaluate_approximate};
33

44
#[derive(Parser)]
55
#[command(

0 commit comments

Comments
 (0)