Skip to content

Commit 10f921c

Browse files
committed
Cleanup
1 parent 0f733c0 commit 10f921c

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

README.md

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

164164
### Minimum rustc version (MSRV)
165165

166-
Currently, Rust version 1.77.0 or later is required. General policy is that rust version from 1 year ago is supported.
166+
Currently, Rust version 1.81.0 or later is required. General policy is that rust version from 1 year ago is supported.
167167
Bumping versions older than that is not considered a breaking change.
168168

169169
### Platform support

binding-generator/src/constant.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::borrow::Cow;
2-
use std::fmt::Write;
32

43
use clang::token::{Token, TokenKind};
54
use clang::{Entity, EntityKind, EvaluationResult};
@@ -142,7 +141,9 @@ impl Value {
142141
for t in tokens {
143142
match t.get_kind() {
144143
TokenKind::Comment => {
145-
write!(out.value, "/* {} */", t.get_spelling()).expect("write! to String shouldn't fail");
144+
out.value.push_str("/* ");
145+
out.value.push_str(&t.get_spelling());
146+
out.value.push_str(" */");
146147
}
147148
TokenKind::Identifier => {
148149
let spelling = t.get_spelling();
@@ -188,7 +189,7 @@ impl Value {
188189
if spelling == "{" || spelling == "}" {
189190
return None;
190191
}
191-
out.value += &t.get_spelling();
192+
out.value += &spelling;
192193
}
193194
}
194195
}

binding-generator/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ fn get_definition_text(entity: Entity) -> String {
9999
}
100100

101101
fn reserved_rename(val: Cow<str>) -> Cow<str> {
102-
if let Some(&v) = settings::RESERVED_RENAME.get(val.as_ref()) {
103-
v.into()
104-
} else {
105-
val
106-
}
102+
settings::RESERVED_RENAME.get(val.as_ref()).map_or(val, |&v| v.into())
107103
}
108104

109105
#[inline(always)]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl RustElement for Class<'_, '_> {
3737
if self.string_type().is_some() {
3838
"String".into()
3939
} else {
40-
let cpp_declname = self.cpp_name(CppNameStyle::Declaration);
40+
let cpp_declname = DefaultRustNativeElement::rust_leafname(self);
4141
if cpp_declname == "Vec" {
4242
"VecN".into()
4343
} else {

0 commit comments

Comments
 (0)