Skip to content

Commit a2ab8f9

Browse files
committed
Bump MSRV to 1.82.0
1 parent 1f57df3 commit a2ab8f9

File tree

13 files changed

+20
-23
lines changed

13 files changed

+20
-23
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ license = "MIT"
1010
version = "0.96.0"
1111
# bump edition to 2024 when MSRV is 1.85
1212
edition = "2021"
13-
rust-version = "1.81.0"
13+
rust-version = "1.82.0"
1414
authors = ["Pro <twisted.fall@gmail.com>", "Mathieu Poumeyrol <kali@zoy.org>"]
1515
exclude = ["/.github", "/ci", "/tools", "/.editorconfig", "/.gitattributes", "/release.toml", "/rustfmt.toml", ".gitignore"]
1616

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ The following OpenCV versions are supported at the moment:
171171

172172
### Minimum rustc version (MSRV)
173173

174-
Currently, Rust version 1.81.0 or later is required. General policy is that rust version from 1 year ago is supported.
174+
Currently, Rust version 1.82.0 or later is required. General policy is that rust version from 1 year ago is supported.
175175
Bumping versions older than that is not considered a breaking change.
176176

177177
### Platform support

binding-generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version = "0.98.0"
77
license = "MIT"
88
authors = ["Pro <twisted.fall@gmail.com>"]
99
edition = "2021"
10-
rust-version = "1.81.0"
10+
rust-version = "1.82.0"
1111
exclude = ["release.toml"]
1212

1313
[lib]

binding-generator/src/class.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<'tu, 'ge> Class<'tu, 'ge> {
453453
let fld_declname = fld_refname.localname();
454454
let (mut read_const_yield, mut read_mut_yield) = if read_write.is_read() {
455455
if fld_const.is_mut() && passed_by_ref {
456-
let read_const_func = if constness_filter.map_or(true, |c| c.is_const()) {
456+
let read_const_func = if constness_filter.is_none_or(|c| c.is_const()) {
457457
Some(Func::new_desc(
458458
FuncDesc::new(
459459
FuncKind::FieldAccessor(cls.clone(), fld.clone()),
@@ -472,7 +472,7 @@ impl<'tu, 'ge> Class<'tu, 'ge> {
472472
} else {
473473
None
474474
};
475-
let read_mut_func = if constness_filter.map_or(true, |c| c.is_mut()) {
475+
let read_mut_func = if constness_filter.is_none_or(|c| c.is_mut()) {
476476
Some(Func::new_desc(
477477
FuncDesc::new(
478478
FuncKind::FieldAccessor(cls.clone(), fld.clone()),
@@ -493,7 +493,7 @@ impl<'tu, 'ge> Class<'tu, 'ge> {
493493
};
494494
(read_const_func, read_mut_func)
495495
} else {
496-
let single_read_func = if constness_filter.map_or(true, |c| c == fld_const) {
496+
let single_read_func = if constness_filter.is_none_or(|c| c == fld_const) {
497497
Some(Func::new_desc(
498498
FuncDesc::new(
499499
FuncKind::FieldAccessor(cls.clone(), fld.clone()),
@@ -518,7 +518,7 @@ impl<'tu, 'ge> Class<'tu, 'ge> {
518518
(None, None)
519519
};
520520
let mut write_yield = if read_write.is_write()
521-
&& constness_filter.map_or(true, |c| c.is_mut())
521+
&& constness_filter.is_none_or(|c| c.is_mut())
522522
&& !fld_type_ref.constness().is_const()
523523
&& !fld_type_kind.as_fixed_array().is_some()
524524
{

binding-generator/src/element.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ impl DefaultElement {
3737
}
3838

3939
pub fn is_public(entity: Entity) -> bool {
40-
// MSRV: use `is_none_or` when MSRV is 1.82
41-
entity.get_accessibility().map_or(true, |a| Accessibility::Public == a)
40+
entity.get_accessibility().is_none_or(|a| Accessibility::Public == a)
4241
}
4342

4443
pub fn cpp_namespace(entity: Entity) -> String {

binding-generator/src/string_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl StringExt for String {
219219
for line in lines {
220220
// there is more than just a newline in the buffer
221221
if line.len() > 1 {
222-
self.extend(iter::repeat(indent.symbol).take(indent.len));
222+
self.extend(iter::repeat_n(indent.symbol, indent.len));
223223
}
224224
self.push_str(line);
225225
}

binding-generator/src/typedef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl<'tu, 'ge> Typedef<'tu, 'ge> {
4141
let _ = entity.walk_children_while(|child| {
4242
let child_unnamed_or_same_name = child
4343
.get_name()
44-
.map_or(true, |child_name| Some(child_name) == entity.get_name());
44+
.is_none_or(|child_name| Some(child_name) == entity.get_name());
4545
if child_unnamed_or_same_name {
4646
match child.get_kind() {
4747
EntityKind::StructDecl => {

binding-generator/src/writer/rust_native/element.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl DefaultRustNativeElement {
4646
match parent.get_kind() {
4747
EntityKind::ClassDecl | EntityKind::StructDecl | EntityKind::ClassTemplate => {
4848
let parent_name = parent.get_name().expect("Can't get parent name");
49-
if parts.last().map_or(true, |last| last != &parent_name) {
49+
if parts.last().is_none_or(|last| last != &parent_name) {
5050
parts.push(parent_name.into());
5151
}
5252
}

build/generator/collector.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'r> Collector<'r> {
171171
writeln!(sys_rs, "mod {module_rust_safe_name}_sys {{")?;
172172
writeln!(sys_rs, "\tuse super::*;")?;
173173
writeln!(sys_rs)?;
174-
writeln!(sys_rs, "\textern \"C\" {{")?;
174+
writeln!(sys_rs, "\tunsafe extern \"C\" {{")?;
175175
copy_indent(BufReader::new(File::open(&externs_rs)?), sys_rs, "\t\t")?;
176176
let _ = fs::remove_file(externs_rs);
177177
let mut type_extern_files = files_with_extension(self.out_dir, "rs")?
@@ -199,16 +199,15 @@ impl<'r> Collector<'r> {
199199
writeln!(hub_rs, "\nmod ffi_exports {{")?;
200200
writeln!(hub_rs, "\tuse crate::mod_prelude_sys::*;")?;
201201
write!(hub_rs, "\t")?;
202-
// MSRV: use #[unsafe(no_mangle)] when MSRV is 1.82
203202
writeln!(
204203
hub_rs,
205-
r#"#[no_mangle] unsafe extern "C" fn ocvrs_create_string{}(s: *const c_char) -> *mut String {{ unsafe {{ crate::templ::ocvrs_create_string(s) }} }}"#,
204+
r#"#[unsafe(no_mangle)] unsafe extern "C" fn ocvrs_create_string{}(s: *const c_char) -> *mut String {{ unsafe {{ crate::templ::ocvrs_create_string(s) }} }}"#,
206205
self.ffi_export_suffix
207206
)?;
208207
write!(hub_rs, "\t")?;
209208
writeln!(
210209
hub_rs,
211-
r#"#[no_mangle] unsafe extern "C" fn ocvrs_create_byte_string{}(v: *const u8, len: size_t) -> *mut Vec<u8> {{ unsafe {{ crate::templ::ocvrs_create_byte_string(v, len) }} }}"#,
210+
r#"#[unsafe(no_mangle)] unsafe extern "C" fn ocvrs_create_byte_string{}(v: *const u8, len: size_t) -> *mut Vec<u8> {{ unsafe {{ crate::templ::ocvrs_create_byte_string(v, len) }} }}"#,
212211
self.ffi_export_suffix
213212
)?;
214213
writeln!(hub_rs, "}}")?;

build/library.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl Library {
288288
.map(|p| LinkSearch(Linkage::Default, p))
289289
.collect(),
290290
));
291-
if link_paths.map_or(true, |link_paths| link_paths.is_extend()) {
291+
if link_paths.is_none_or(|link_paths| link_paths.is_extend()) {
292292
cargo_metadata.extend(Self::process_link_paths(
293293
None,
294294
opencv

0 commit comments

Comments
 (0)