Skip to content

Commit 7361ab1

Browse files
committed
Cleanup
1 parent e22fb22 commit 7361ab1

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl RustNativeGeneratedElement for Func<'_, '_> {
389389
.rust_extern_arg_func_decl("instance"),
390390
);
391391
}
392-
for (name, arg) in rust_disambiguate_names(self.arguments().into_owned()) {
392+
for (name, arg) in rust_disambiguate_names_ref(self.arguments().as_ref()) {
393393
args.push(arg.type_ref().render_lane().to_dyn().rust_extern_arg_func_decl(&name))
394394
}
395395

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,19 @@ where
302302
NamePool::with_capacity(size_hint.1.unwrap_or(size_hint.0)).into_disambiguator(args, |f| f.rust_leafname(FishStyle::No))
303303
}
304304

305+
fn rust_disambiguate_names_ref<'f, 'tu, 'ge>(
306+
args: impl IntoIterator<Item = &'f Field<'tu, 'ge>>,
307+
) -> impl Iterator<Item = (String, &'f Field<'tu, 'ge>)>
308+
where
309+
'tu: 'ge,
310+
'tu: 'f,
311+
'ge: 'f,
312+
{
313+
let args = args.into_iter();
314+
let size_hint = args.size_hint();
315+
NamePool::with_capacity(size_hint.1.unwrap_or(size_hint.0)).into_disambiguator(args, |f| f.rust_leafname(FishStyle::No))
316+
}
317+
305318
pub fn disambiguate_single_name(name: &str) -> impl Iterator<Item = String> + '_ {
306319
let mut i = 0;
307320
iter::from_fn(move || {

binding-generator/src/writer/rust_native/type_ref/lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ impl Lifetime {
2727

2828
pub fn is_explicit(&self) -> bool {
2929
match self {
30-
Lifetime::Elided => false,
31-
Lifetime::Custom(_) | Lifetime::Automatic(_) => true,
30+
Self::Elided => false,
31+
Self::Custom(_) | Self::Automatic(_) => true,
3232
}
3333
}
3434

@@ -44,7 +44,7 @@ impl Lifetime {
4444
}
4545

4646
impl IntoIterator for Lifetime {
47-
type Item = Lifetime;
47+
type Item = Self;
4848
type IntoIter = LifetimeIterator;
4949

5050
fn into_iter(self) -> LifetimeIterator {

0 commit comments

Comments
 (0)