Skip to content

Commit 55482eb

Browse files
authored
Merge pull request #192 from projectsyn/feat/rust-2024
Switch to Rust 2024 Edition
2 parents e9c1e0f + 9642140 commit 55482eb

17 files changed

Lines changed: 113 additions & 114 deletions

.rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
edition = "2024"

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
22
name = "reclass-rs"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
5+
rust-version = "1.87"
56
license = "BSD-3-Clause"
67
authors = ["VSHN AG <info@vshn.ch>"]
78
repository = "https://github.com/projectsyn/reclass-rs"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Documentation on Reclass extensions introduced in the Kapicorp Reclass fork can
4343
## Prerequisites
4444

4545
* Python >= 3.9
46-
* Rust >= 1.56 (we recommend installing the latest stable toolchain with [rustup])
46+
* Rust >= 1.87 (we recommend installing the latest stable toolchain with [rustup])
4747

4848
## Setup local development environment for Python bindings
4949

benches/inventory_multi_threaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, criterion_group, criterion_main};
22
use rayon::ThreadPoolBuilder;
33
use std::hint::black_box;
44

benches/inventory_single_threaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, criterion_group, criterion_main};
22
use rayon::ThreadPoolBuilder;
33
use std::hint::black_box;
44

src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
use anyhow::{anyhow, Result};
1+
use anyhow::{Result, anyhow};
22
use fancy_regex::Regex;
33
use pyo3::exceptions::PyValueError;
44
use pyo3::prelude::*;
55
use pyo3::types::{PyDict, PyType};
66
use regex::RegexSet;
7-
use std::collections::hash_map::DefaultHasher;
87
use std::collections::HashSet;
8+
use std::collections::hash_map::DefaultHasher;
99
use std::hash::{Hash, Hasher};
1010
use std::path::PathBuf;
1111
use std::sync::LazyLock;
1212

13+
use crate::NodeInfoMeta;
1314
use crate::fsutil::to_lexical_normal;
1415
use crate::list::{List, UniqueList};
15-
use crate::NodeInfoMeta;
1616

1717
/// Flags to change reclass-rs behavior to be compaible with Python reclass
1818
#[pyclass(eq, eq_int)]

src/inventory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, Result};
1+
use anyhow::{Result, anyhow};
22
use chrono::Local;
33
use pyo3::prelude::*;
44
use pyo3::types::PyDict;

src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ mod node;
1818
mod refs;
1919
pub mod types;
2020

21-
use anyhow::{anyhow, Result};
21+
use anyhow::{Result, anyhow};
2222
use pyo3::exceptions::PyValueError;
2323
use pyo3::prelude::*;
2424
use pyo3::types::PyType;
2525
use rayon::ThreadPoolBuilder;
2626
use std::collections::HashMap;
27-
use std::path::{Path, PathBuf, MAIN_SEPARATOR};
27+
use std::path::{MAIN_SEPARATOR, Path, PathBuf};
2828
use walkdir::WalkDir;
2929

3030
use config::{CompatFlag, Config};
@@ -134,12 +134,9 @@ fn walk_entity_dir(
134134
for entry in WalkDir::new(root).follow_links(true) {
135135
let entry = entry?;
136136
// We use `entry.path()` here to get the symlink name for symlinked files.
137-
let ext = if let Some(ext) = entry.path().extension() {
138-
ext.to_str()
139-
} else {
140-
None
141-
};
142-
if ext.is_some() && SUPPORTED_YAML_EXTS.contains(&ext.unwrap()) {
137+
if let Some(ext) = entry.path().extension().and_then(|e| e.to_str())
138+
&& SUPPORTED_YAML_EXTS.contains(&ext)
139+
{
143140
// it's an entity (class or node), process it
144141
let abspath = to_lexical_absolute(entry.path())?;
145142
let relpath = abspath.strip_prefix(&entity_root)?;

src/list/removable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::Deserialize;
22

3-
use super::{item_pos, List};
3+
use super::{List, item_pos};
44

55
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
66
#[serde(from = "Vec<String>")]

src/list/unique.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::Deserialize;
22

3-
use super::{item_pos, List};
3+
use super::{List, item_pos};
44

55
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
66
#[serde(from = "Vec<String>")]

0 commit comments

Comments
 (0)