clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-09-22 10:00:33 +02:00
parent 02e4344e7e
commit f8b49fc1be
4 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ pub fn handle_function(
}
let name = func.sig.ident.clone();
let export_public = export_public.then(|| &func.vis);
let export_public = export_public.then_some(&func.vis);
let xs_name = attr
.xs_name
.clone()

View File

@ -413,7 +413,7 @@ impl ScalarRef {
/// If `blessed` is true and the value is a blessed reference, the package name will be
/// returned, otherwise the scalar type (`"SCALAR"`, `"ARRAY"`, ...) will be returned.
pub fn reftype(&self, blessed: bool) -> &'static str {
let ptr = unsafe { ffi::RSPL_sv_reftype(self.sv(), if blessed { 1 } else { 0 }) };
let ptr = unsafe { ffi::RSPL_sv_reftype(self.sv(), i32::from(blessed)) };
if ptr.is_null() {
"<UNKNOWN>"

View File

@ -64,7 +64,7 @@ impl<'a> ser::Serializer for &'a mut Serializer {
type SerializeStructVariant = SerVariant<SerHash>;
fn serialize_bool(self, v: bool) -> Result<Value, Error> {
Ok(Value::new_uint(if v { 1 } else { 0 }))
Ok(Value::new_uint(usize::from(v)))
}
fn serialize_i8(self, v: i8) -> Result<Value, Error> {

View File

@ -527,7 +527,7 @@ impl<'de> Deserialize<'de> for Value {
#[inline]
fn visit_bool<E>(self, value: bool) -> Result<Value, E> {
Ok(Value::new_int(if value { 1 } else { 0 }))
Ok(Value::new_int(isize::from(value)))
}
#[inline]