Skip to content

Commit

Permalink
Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Nov 17, 2024
1 parent b63dca2 commit 4479894
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 21 deletions.
12 changes: 6 additions & 6 deletions api/rust/cargo/lief/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ macro_rules! declare_iterator_conv {
#[macro_export]
macro_rules! declare_iterator {
($name:ident, $from:ty, $ffi:ty, $parent:ty, $ffi_iterator:ty) => {
crate::declare_iterator_conv!($name, $from, $ffi, $parent, $ffi_iterator, |n| {
$crate::declare_iterator_conv!($name, $from, $ffi, $parent, $ffi_iterator, |n| {
Self::Item::from_ffi(n)
});
};
Expand Down Expand Up @@ -124,7 +124,7 @@ macro_rules! declare_fwd_iterator_conv {
#[macro_export]
macro_rules! declare_fwd_iterator {
($name:ident, $from:ty, $ffi:ty, $parent:ty, $ffi_iterator:ty) => {
crate::declare_fwd_iterator_conv!($name, $from, $ffi, $parent, $ffi_iterator, |n| {
$crate::declare_fwd_iterator_conv!($name, $from, $ffi, $parent, $ffi_iterator, |n| {
Self::Item::from_ffi(n)
});
};
Expand Down Expand Up @@ -154,7 +154,7 @@ macro_rules! to_result {

let value = $func(&$self.ptr, $($arg),*, std::pin::Pin::new(&mut err));
if err > 0 {
return Err(crate::Error::from(err));
return Err($crate::Error::from(err));
}
return Ok(value);
};
Expand All @@ -163,7 +163,7 @@ macro_rules! to_result {
let value = $func(&$self.ptr, std::pin::Pin::new(&mut err));

if err > 0 {
return Err(crate::Error::from(err));
return Err($crate::Error::from(err));
}
return Ok(value);
};
Expand All @@ -176,15 +176,15 @@ macro_rules! to_conv_result {
let mut err: u32 = 0;
let value = $func(&$self, $($arg),*, std::pin::Pin::new(&mut err));
if err > 0 {
return Err(crate::Error::from(err));
return Err($crate::Error::from(err));
}
return Ok($conv(value));
};
($func: expr, $self: expr, $conv: expr) => {
let mut err: u32 = 0;
let value = $func(&$self, std::pin::Pin::new(&mut err));
if err > 0 {
return Err(crate::Error::from(err));
return Err($crate::Error::from(err));
}
return Ok($conv(value));
};
Expand Down
1 change: 0 additions & 1 deletion api/rust/cargo/lief/src/dwarf/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use lief_ffi::LIEF::PE::Import;
use lief_ffi as ffi;

use crate::{common::FromFFI, Error};
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/coarray.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_coarray_type`
pub struct Coarray<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_dynamic_type`
pub struct Dynamic<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/enum_type.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common:: FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_enumeration_type`
pub struct Enum<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/file.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_file_type`
pub struct File<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/interface.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_interface_type`
pub struct Interface<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/string.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;

/// This structure represents a `DW_TAG_string_type`
pub struct StringTy<'a> {
Expand Down
3 changes: 1 addition & 2 deletions api/rust/cargo/lief/src/dwarf/types/subroutine.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use lief_ffi as ffi;

use crate::common::{into_optional, FromFFI};
use crate::common::FromFFI;
use std::marker::PhantomData;
use crate::dwarf::types::DwarfType;
use crate::dwarf::Type;
use crate::declare_fwd_iterator;
use crate::dwarf::Parameters;

Expand Down

0 comments on commit 4479894

Please sign in to comment.