Skip to content

Commit 152b554

Browse files
committed
Fix clippy warnings
1 parent b86130b commit 152b554

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

rustler/src/resource.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,8 @@ pub fn open_struct_resource_type<'a, T: ResourceTypeProvider>(
8585
flags,
8686
)
8787
};
88-
if let Some(res) = res {
89-
Some(ResourceType {
90-
res,
91-
struct_type: PhantomData,
92-
})
93-
} else {
94-
None
95-
}
88+
89+
res.map(|r| ResourceType { res: r, struct_type: PhantomData})
9690
}
9791

9892
fn get_alloc_size_struct<T>() -> usize {

rustler_tests/native/rustler_test/src/test_primitives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn echo_u8<'a>(env: Env<'a>, args: &[Term<'a>]) -> NifResult<Term<'a>> {
2020

2121
pub fn option_inc<'a>(env: Env<'a>, args: &[Term<'a>]) -> NifResult<Term<'a>> {
2222
let opt: Option<f64> = args[0].decode()?;
23-
let incremented = opt.and_then(|num| Some(num + 1.0));
23+
let incremented = opt.map(|num| num + 1.0);
2424
Ok(incremented.encode(env))
2525
}
2626

0 commit comments

Comments
 (0)