From ad9ab3f0761af1751e0e2d19b140f8c8fc5e3324 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Tue, 20 Mar 2018 20:17:26 +0100 Subject: fix some compiler warning regarding opaque structs --- Cargo.toml | 1 - src/error.rs | 1 - src/ffi.rs | 26 +++++++++++++------------- src/lib.rs | 2 -- src/utils.rs | 2 -- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a67079f..1f9adc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,4 @@ authors = ["C. Morgan Hamill ", "Dirk Van Haerenborgh "] [dependencies] -notmuch-sys = "*" libc = "0.2" diff --git a/src/error.rs b/src/error.rs index 046e17f..b1e5cdc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,7 +6,6 @@ use std::{ result, }; -use ffi_sys; use ffi; pub type Result = result::Result; diff --git a/src/ffi.rs b/src/ffi.rs index 6d2ceeb..bd59941 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -27,7 +27,7 @@ pub type notmuch_compact_status_cb_t = extern fn(*const c_char, *mut c_void); notmuch_enum! { #[repr(C)] - #[derive(Copy, Clone, Debug)] + #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum notmuch_status_t => Status { NOTMUCH_STATUS_SUCCESS => Success, NOTMUCH_STATUS_OUT_OF_MEMORY => OutOfMemory, @@ -86,7 +86,7 @@ impl error::Error for Status { notmuch_enum! { #[repr(C)] - #[derive(Copy, Clone, Debug)] + #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum notmuch_database_mode_t => Mode { NOTMUCH_DATABASE_MODE_READ_ONLY => ReadOnly, NOTMUCH_DATABASE_MODE_READ_WRITE => ReadWrite @@ -95,7 +95,7 @@ notmuch_enum! { notmuch_enum! { #[repr(C)] - #[derive(Copy, Clone, Debug)] + #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum notmuch_sort_t => Sort { NOTMUCH_SORT_OLDEST_FIRST => OldestFirst, NOTMUCH_SORT_NEWEST_FIRST => NewestFirst, @@ -117,7 +117,7 @@ notmuch_enum! { notmuch_enum! { #[repr(C)] - #[derive(Copy, Clone, Debug)] + #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum notmuch_message_flag_t => MessageFlag { NOTMUCH_MESSAGE_FLAG_MATCH => Match, NOTMUCH_MESSAGE_FLAG_EXCLUDED => Excluded, @@ -125,15 +125,15 @@ notmuch_enum! { } } -#[repr(C)] pub struct notmuch_database_t; -#[repr(C)] pub struct notmuch_query_t; -#[repr(C)] pub struct notmuch_threads_t; -#[repr(C)] pub struct notmuch_thread_t; -#[repr(C)] pub struct notmuch_messages_t; -#[repr(C)] pub struct notmuch_message_t; -#[repr(C)] pub struct notmuch_tags_t; -#[repr(C)] pub struct notmuch_directory_t; -#[repr(C)] pub struct notmuch_filenames_t; +#[repr(C)] pub struct notmuch_database_t(c_void); +#[repr(C)] pub struct notmuch_query_t(c_void); +#[repr(C)] pub struct notmuch_threads_t(c_void); +#[repr(C)] pub struct notmuch_thread_t(c_void); +#[repr(C)] pub struct notmuch_messages_t(c_void); +#[repr(C)] pub struct notmuch_message_t(c_void); +#[repr(C)] pub struct notmuch_tags_t(c_void); +#[repr(C)] pub struct notmuch_directory_t(c_void); +#[repr(C)] pub struct notmuch_filenames_t(c_void); #[link(name = "notmuch")] extern { diff --git a/src/lib.rs b/src/lib.rs index 63d190f..c7984e0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,6 @@ - #[macro_use] mod macros; -extern crate notmuch_sys as ffi_sys; extern crate libc; mod utils; diff --git a/src/utils.rs b/src/utils.rs index af3ce29..8aad8f7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -4,8 +4,6 @@ use std::{ str, }; -use std::os::unix::ffi::OsStrExt; - use libc; pub trait NewFromPtr { -- cgit v1.2.1