forked from meli/meli
1
Fork 0

Normalize std::fmt::* imports

jmap-submission
Manos Pitsidianakis 2023-08-11 13:16:47 +03:00
parent 7c9a4b4b7c
commit 5c2b04719b
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
37 changed files with 161 additions and 177 deletions

View File

@ -20,34 +20,17 @@
*/
//! Components visual and logical separations of application interfaces.
use indexmap::IndexMap;
///
/// They can draw on the terminal and receive events, but also do other stuff
/// as well.
/// For an example, see the [`notifications`] module.
/// See also the [`Component`] trait for more details.
use smallvec::SmallVec;
use uuid::Uuid;
use super::*;
pub mod notifications;
pub mod mailbox_management;
pub use mailbox_management::*;
pub mod jobs_view;
pub use jobs_view::*;
#[cfg(feature = "svgscreenshot")]
pub mod svg;
use std::{
fmt,
fmt::{Debug, Display},
};
use indexmap::IndexMap;
use uuid::Uuid;
#[derive(Clone, Copy, Eq, Deserialize, Hash, Ord, PartialOrd, PartialEq, Serialize)]
#[repr(transparent)]
pub struct ComponentId(Uuid);
@ -124,7 +107,7 @@ pub enum ScrollUpdate {
/// If a type wants to skip drawing if it has not changed anything, it can hold
/// some flag in its fields (eg `self.dirty = false`) and act upon that in their
/// [`draw`](Component::draw) implementation.
pub trait Component: Display + Debug + Send + Sync {
pub trait Component: std::fmt::Display + std::fmt::Debug + Send + Sync {
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context);
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool;
fn is_dirty(&self) -> bool;

View File

@ -315,8 +315,8 @@ impl Drop for JobRequest {
}
}
impl core::fmt::Debug for JobRequest {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for JobRequest {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
JobRequest::Generic { name, .. } => write!(f, "JobRequest::Generic({})", name),
JobRequest::Mailboxes { .. } => write!(f, "JobRequest::Mailboxes"),
@ -348,8 +348,8 @@ impl core::fmt::Debug for JobRequest {
}
}
impl core::fmt::Display for JobRequest {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Display for JobRequest {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
JobRequest::Generic { name, .. } => write!(f, "{}", name),
JobRequest::Mailboxes { .. } => write!(f, "Get mailbox list"),

View File

@ -71,14 +71,14 @@ macro_rules! uuid_hash_type {
#[derive(PartialEq, Hash, Eq, Copy, Clone, Ord, PartialOrd, Serialize, Deserialize)]
pub struct $n(Uuid);
impl core::fmt::Debug for $n {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for $n {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.0.to_string())
}
}
impl core::fmt::Display for $n {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Display for $n {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.0.to_string())
}
}

View File

@ -21,6 +21,8 @@
use std::{borrow::Cow, cmp};
use indexmap::IndexMap;
use super::*;
use crate::{
jobs::{JobId, JobMetadata},
@ -45,8 +47,8 @@ pub struct JobManager {
id: ComponentId,
}
impl fmt::Display for JobManager {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for JobManager {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "jobs")
}
}

View File

@ -83,6 +83,17 @@ pub use crate::contacts::*;
pub mod mail;
pub use crate::mail::*;
pub mod notifications;
pub mod mailbox_management;
pub use mailbox_management::*;
pub mod jobs_view;
pub use jobs_view::*;
#[cfg(feature = "svgscreenshot")]
pub mod svg;
#[macro_use]
pub mod conf;
pub use crate::conf::{

View File

@ -849,7 +849,7 @@ pub enum ListingComponent {
}
use crate::ListingComponent::*;
impl core::ops::Deref for ListingComponent {
impl std::ops::Deref for ListingComponent {
type Target = dyn MailListingTrait;
fn deref(&self) -> &Self::Target {
@ -863,7 +863,7 @@ impl core::ops::Deref for ListingComponent {
}
}
impl core::ops::DerefMut for ListingComponent {
impl std::ops::DerefMut for ListingComponent {
fn deref_mut(&mut self) -> &mut (dyn MailListingTrait + 'static) {
match self {
Compact(l) => l.as_mut(),

View File

@ -20,6 +20,7 @@
*/
use std::cmp;
use indexmap::IndexMap;
use melib::backends::AccountHash;
use super::*;
@ -61,8 +62,8 @@ pub struct MailboxManager {
id: ComponentId,
}
impl fmt::Display for MailboxManager {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for MailboxManager {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "mailboxes")
}
}

View File

@ -142,7 +142,7 @@ fn run_app(opt: Opt) -> Result<()> {
} else {
state = State::new(None, sender, receiver.clone())?;
#[cfg(feature = "svgscreenshot")]
state.register_component(Box::new(components::svg::SVGScreenshotFilter::new()));
state.register_component(Box::new(svg::SVGScreenshotFilter::new()));
let window = Box::new(Tabbed::new(
vec![
Box::new(listing::Listing::new(&mut state.context)),
@ -156,14 +156,11 @@ fn run_app(opt: Opt) -> Result<()> {
#[cfg(all(target_os = "linux", feature = "dbus-notifications"))]
{
let dbus_notifications = Box::new(components::notifications::DbusNotifications::new(
&state.context,
));
let dbus_notifications =
Box::new(notifications::DbusNotifications::new(&state.context));
state.register_component(dbus_notifications);
}
state.register_component(Box::new(
components::notifications::NotificationCommand::new(),
));
state.register_component(Box::new(notifications::NotificationCommand::new()));
}
let enter_command_mode: Key = state
.context

View File

@ -39,8 +39,8 @@ mod dbus {
id: ComponentId,
}
impl fmt::Display for DbusNotifications {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for DbusNotifications {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "")
}
}
@ -179,8 +179,8 @@ impl NotificationCommand {
}
}
impl fmt::Display for NotificationCommand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for NotificationCommand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "")
}
}

View File

@ -39,9 +39,9 @@ impl RpcChannel {
stream,
session: *session,
};
let greeting: PluginGreeting = ret.from_read().map_err(|err| {
Error::new(format!("Could not get correct plugin greeting: {}", err))
})?;
let greeting: PluginGreeting = ret
.from_read()
.map_err(|err| Error::new(format!("Could not get correct plugin greeting: {}", err)))?;
debug!(&greeting);
//if greeting.version != "dev" {
// return Err("Plugin is not compatible with our API (dev)".into());
@ -93,7 +93,7 @@ impl RpcChannel {
pub fn from_read<T>(&mut self) -> Result<T>
where
T: core::fmt::Debug + serde::de::DeserializeOwned,
T: std::fmt::Debug + serde::de::DeserializeOwned,
{
debug!("from_read()");
let ret: Result<T> = debug!(rmp_serde::decode::from_read(&mut self.stream))
@ -125,12 +125,12 @@ impl RpcResult {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "t", content = "c")]
pub enum PluginResult<T: core::fmt::Debug + Clone> {
pub enum PluginResult<T: std::fmt::Debug + Clone> {
Ok(T),
Err(String),
}
impl<T: core::fmt::Debug + Clone + serde::Serialize + serde::de::DeserializeOwned> Into<Result<T>>
impl<T: std::fmt::Debug + Clone + serde::Serialize + serde::de::DeserializeOwned> Into<Result<T>>
for PluginResult<T>
{
fn into(self) -> Result<T> {

View File

@ -29,8 +29,8 @@ pub struct SVGScreenshotFilter {
id: ComponentId,
}
impl fmt::Display for SVGScreenshotFilter {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for SVGScreenshotFilter {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "svg screenshot filter")
}
}

View File

@ -35,7 +35,6 @@ pub mod cells;
pub mod keys;
pub mod embed;
pub mod text_editing;
use std::fmt;
pub use braille::BraillePixelIter;
pub use screen::{Screen, StateStdout};
@ -63,8 +62,8 @@ macro_rules! derive_csi_sequence {
#[derive(Copy, Clone)]
pub struct $name;
impl fmt::Display for $name {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for $name {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, csi!($value))
}
}

View File

@ -25,7 +25,6 @@
use std::{
collections::HashMap,
convert::From,
fmt,
ops::{Deref, DerefMut, Index, IndexMut},
};
@ -74,8 +73,8 @@ pub struct CellBuffer {
tag_associations: SmallVec<[(u64, (usize, usize)); 128]>,
}
impl fmt::Debug for CellBuffer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Debug for CellBuffer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CellBuffer")
.field("cols", &self.cols)
.field("rows", &self.rows)
@ -466,8 +465,8 @@ impl Default for CellBuffer {
}
}
impl fmt::Display for CellBuffer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for CellBuffer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
'_y: for y in 0..self.rows {
for x in 0..self.cols {
let c: &char = &self[(x, y)].ch();
@ -766,8 +765,8 @@ impl Default for Attr {
}
}
impl fmt::Display for Attr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for Attr {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
Attr::DEFAULT => write!(f, "Default"),
Attr::BOLD => write!(f, "Bold"),
@ -1756,14 +1755,14 @@ pub struct FormatTag {
pub priority: u8,
}
impl core::cmp::Ord for FormatTag {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
impl std::cmp::Ord for FormatTag {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.priority.cmp(&other.priority)
}
}
impl core::cmp::PartialOrd for FormatTag {
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
impl std::cmp::PartialOrd for FormatTag {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

View File

@ -141,8 +141,8 @@ impl From<TermionMouseButton> for MouseButton {
}
}
impl fmt::Display for Key {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for Key {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use crate::Key::*;
match self {
F(n) => write!(f, "F{}", n),
@ -319,7 +319,7 @@ impl<'de> Deserialize<'de> for Key {
impl<'de> Visitor<'de> for KeyVisitor {
type Value = Key;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter
.write_str("a valid key value. Please consult the manual for valid key inputs.")
}

View File

@ -36,7 +36,7 @@
#[macro_use]
mod helpers;
use std::{borrow::Cow, fmt, sync::Arc};
use std::{borrow::Cow, sync::Arc};
pub use helpers::*;
use melib::{
@ -107,8 +107,8 @@ pub enum NotificationType {
Saved,
}
impl core::fmt::Display for NotificationType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for NotificationType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
NotificationType::Info => write!(f, "info"),
NotificationType::Error(melib::error::ErrorKind::None) => write!(f, "error"),
@ -167,8 +167,8 @@ pub enum UIEvent {
pub struct CallbackFn(pub Box<dyn FnOnce(&mut crate::Context) + Send + 'static>);
impl core::fmt::Debug for CallbackFn {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for CallbackFn {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "CallbackFn")
}
}
@ -189,8 +189,8 @@ pub enum UIMode {
Fork,
}
impl fmt::Display for UIMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for UIMode {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
"{}",
@ -241,7 +241,7 @@ pub mod segment_tree {
let max_size = 2 * (2_usize.pow(height));
let mut segment_tree: SmallVec<[u8; 1024]> =
SmallVec::from_iter(core::iter::repeat(0).take(max_size));
SmallVec::from_iter(std::iter::repeat(0).take(max_size));
for i in 0..val.len() {
segment_tree[val.len() + i] = val[i];
}

View File

@ -970,7 +970,7 @@ impl UIConfirmationDialog {
.filter(|v| v.1)
.map(|(id, _)| id)
.cloned()
.any(core::convert::identity),
.any(std::convert::identity),
)
})
}

View File

@ -36,7 +36,7 @@ use crate::{
};
/* Supported vcard versions */
pub trait VCardVersion: core::fmt::Debug {}
pub trait VCardVersion: std::fmt::Debug {}
#[derive(Debug)]
pub struct VCardVersionUnknown;

View File

@ -24,8 +24,6 @@ use std::{
any::Any,
borrow::Cow,
collections::{BTreeSet, HashMap},
fmt,
fmt::Debug,
future::Future,
ops::Deref,
pin::Pin,
@ -308,8 +306,8 @@ impl BackendEventConsumer {
}
}
impl fmt::Debug for BackendEventConsumer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Debug for BackendEventConsumer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "BackendEventConsumer")
}
}
@ -547,7 +545,7 @@ impl SpecialUsageMailbox {
}
}
pub trait BackendMailbox: Debug {
pub trait BackendMailbox: std::fmt::Debug {
fn hash(&self) -> MailboxHash;
/// Final component of `path`.
fn name(&self) -> &str;
@ -668,8 +666,8 @@ pub struct LazyCountSet {
pub set: BTreeSet<EnvelopeHash>,
}
impl fmt::Debug for LazyCountSet {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Debug for LazyCountSet {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("LazyCountSet")
.field("not_yet_seen", &self.not_yet_seen)
.field("set", &self.set.len())

View File

@ -291,8 +291,8 @@ pub struct Envelope {
pub tags: SmallVec<[TagHash; 8]>,
}
impl core::fmt::Debug for Envelope {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for Envelope {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Envelope")
.field("Subject", &self.subject())
.field("Date", &self.date)

View File

@ -18,10 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use std::{
fmt::{Display, Formatter, Result as FmtResult},
str,
};
use std::str;
use crate::email::{
attachments::{Attachment, AttachmentBuilder},
@ -162,8 +159,8 @@ impl<'a> From<&'a [u8]> for Charset {
}
}
impl Display for Charset {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for Charset {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Ascii => write!(f, "us-ascii"),
Self::UTF8 => write!(f, "utf-8"),
@ -208,8 +205,8 @@ pub enum MultipartType {
Signed,
}
impl Display for MultipartType {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for MultipartType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
"{}",
@ -355,8 +352,8 @@ impl PartialEq<&str> for ContentType {
}
}
impl Display for ContentType {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for ContentType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Text { kind: t, .. } => t.fmt(f),
Self::Multipart { kind: k, .. } => k.fmt(f),
@ -455,8 +452,8 @@ impl Text {
}
}
impl Display for Text {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for Text {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
Self::Plain => write!(f, "text/plain"),
Self::Html => write!(f, "text/html"),
@ -478,8 +475,8 @@ pub enum ContentTransferEncoding {
},
}
impl Display for ContentTransferEncoding {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for ContentTransferEncoding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
Self::_7Bit => write!(f, "7bit"),
Self::_8Bit => write!(f, "8bit"),
@ -537,8 +534,8 @@ impl ContentDispositionKind {
}
}
impl Display for ContentDispositionKind {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
impl std::fmt::Display for ContentDispositionKind {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match *self {
Self::Inline => write!(f, "inline"),
Self::Attachment => write!(f, "attachment"),

View File

@ -21,7 +21,7 @@
//! Attachment encoding and decoding.
use core::{fmt, str};
use std::str;
use data_encoding::BASE64_MIME;
use smallvec::SmallVec;
@ -397,8 +397,8 @@ pub struct Attachment {
pub body: StrBuilder,
}
impl fmt::Debug for Attachment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Debug for Attachment {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let mut text = Vec::with_capacity(4096);
self.get_text_recursive(&mut text);
f.debug_struct("Attachment")
@ -410,8 +410,8 @@ impl fmt::Debug for Attachment {
}
}
impl fmt::Display for Attachment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for Attachment {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self.content_type {
ContentType::MessageRfc822 => {
match Mail::new(self.body.display_bytes(&self.raw).to_vec(), None) {

View File

@ -57,8 +57,8 @@ pub struct ParsingError<I> {
pub error: Cow<'static, str>,
}
impl core::fmt::Debug for ParsingError<&'_ [u8]> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for ParsingError<&'_ [u8]> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
fmt.debug_struct("ParsingError")
.field("input", &to_str!(self.input))
.field("error", &self.error)
@ -66,8 +66,8 @@ impl core::fmt::Debug for ParsingError<&'_ [u8]> {
}
}
impl core::fmt::Debug for ParsingError<&'_ str> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Debug for ParsingError<&'_ str> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
fmt.debug_struct("ParsingError")
.field("input", &self.input)
.field("error", &self.error)
@ -77,8 +77,8 @@ impl core::fmt::Debug for ParsingError<&'_ str> {
struct DebugOkWrapper<'r, I, R: AsRef<[u8]>>(&'r IResult<I, R>);
impl<R: AsRef<[u8]> + core::fmt::Debug> core::fmt::Debug for DebugOkWrapper<'_, &'_ [u8], R> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl<R: AsRef<[u8]> + std::fmt::Debug> std::fmt::Debug for DebugOkWrapper<'_, &'_ [u8], R> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
if let Ok((a, b)) = self.0 {
write!(fmt, "Ok({}, {})", &to_str!(a), &to_str!(b.as_ref()))
} else {

View File

@ -21,7 +21,7 @@
//! Library error type.
use std::{borrow::Cow, fmt, io, result, str, string, sync::Arc};
use std::{borrow::Cow, io, result, str, string, sync::Arc};
pub type Result<T> = result::Result<T, Error>;
@ -339,8 +339,8 @@ pub enum ErrorKind {
ValueError,
}
impl fmt::Display for ErrorKind {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for ErrorKind {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
fmt,
"{}",
@ -510,8 +510,8 @@ impl Error {
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.summary)?;
if let Some(details) = self.details.as_ref() {
write!(f, "\n{}", details)?;
@ -580,7 +580,7 @@ impl<T> From<std::sync::PoisonError<T>> for Error {
}
#[cfg(feature = "tls")]
impl<T: Sync + Send + 'static + core::fmt::Debug> From<native_tls::HandshakeError<T>> for Error {
impl<T: Sync + Send + 'static + std::fmt::Debug> From<native_tls::HandshakeError<T>> for Error {
#[inline]
fn from(kind: native_tls::HandshakeError<T>) -> Self {
Self::new(kind.to_string())

View File

@ -62,7 +62,7 @@ pub unsafe extern "C" fn gpgme_register_io_cb(
fd,
io_state: io_state_copy,
}));
core::ptr::write(tag, tag_data as *mut _);
std::ptr::write(tag, tag_data as *mut _);
io_state_lck.ops.insert(idx, gpgfd);
drop(io_state_lck);
let _ = Arc::into_raw(io_state);
@ -98,7 +98,7 @@ pub unsafe extern "C" fn gpgme_event_io_cb(
drop(io_state_lck);
let _ = Arc::into_raw(io_state);
} else if type_ == gpgme_event_io_t_GPGME_EVENT_NEXT_KEY {
if let Some(inner) = core::ptr::NonNull::new(type_data as gpgme_key_t) {
if let Some(inner) = std::ptr::NonNull::new(type_data as gpgme_key_t) {
let io_state: Arc<Mutex<IoState>> = Arc::from_raw(data as *const _);
let io_state_lck = io_state.lock().unwrap();
io_state_lck

View File

@ -200,7 +200,7 @@ unsafe impl Send for IoState {}
unsafe impl Sync for IoState {}
pub struct ContextInner {
inner: core::ptr::NonNull<gpgme_context>,
inner: std::ptr::NonNull<gpgme_context>,
lib: Arc<libloading::Library>,
}
@ -241,7 +241,7 @@ impl Context {
let (sender, receiver) = smol::channel::unbounded();
let (key_sender, key_receiver) = smol::channel::unbounded();
let mut ptr = core::ptr::null_mut();
let mut ptr = std::ptr::null_mut();
let io_state = Arc::new(Mutex::new(IoState {
max_idx: 0,
ops: HashMap::default(),
@ -269,7 +269,7 @@ impl Context {
}
let ret = Self {
inner: Arc::new(ContextInner {
inner: core::ptr::NonNull::new(ptr)
inner: std::ptr::NonNull::new(ptr)
.ok_or_else(|| Error::new("Could not use libgpgme").set_kind(ErrorKind::Bug))?,
lib,
}),
@ -412,7 +412,7 @@ impl Context {
}
pub fn new_data_mem(&self, bytes: &[u8]) -> Result<Data> {
let mut ptr = core::ptr::null_mut();
let mut ptr = std::ptr::null_mut();
let bytes: Pin<Vec<u8>> = Pin::new(bytes.to_vec());
unsafe {
gpgme_error_try(
@ -430,7 +430,7 @@ impl Context {
lib: self.inner.lib.clone(),
kind: DataKind::Memory,
bytes,
inner: core::ptr::NonNull::new(ptr).ok_or_else(|| {
inner: std::ptr::NonNull::new(ptr).ok_or_else(|| {
Error::new("Could not create libgpgme data").set_kind(ErrorKind::Bug)
})?,
})
@ -446,7 +446,7 @@ impl Context {
}
let os_str: &OsStr = path.as_ref();
let bytes = Pin::new(os_str.as_bytes().to_vec());
let mut ptr = core::ptr::null_mut();
let mut ptr = std::ptr::null_mut();
unsafe {
let ret: GpgmeError = call!(&self.inner.lib, gpgme_data_new_from_file)(
&mut ptr,
@ -460,7 +460,7 @@ impl Context {
lib: self.inner.lib.clone(),
kind: DataKind::Memory,
bytes,
inner: core::ptr::NonNull::new(ptr).ok_or_else(|| {
inner: std::ptr::NonNull::new(ptr).ok_or_else(|| {
Error::new("Could not create libgpgme data").set_kind(ErrorKind::Bug)
})?,
})
@ -727,7 +727,7 @@ impl Context {
lib: self.inner.lib.clone(),
kind: DataKind::Memory,
bytes: Pin::new(vec![]),
inner: core::ptr::NonNull::new(sig)
inner: std::ptr::NonNull::new(sig)
.ok_or_else(|| Error::new("internal libgpgme error").set_kind(ErrorKind::Bug))?,
};
@ -833,7 +833,7 @@ impl Context {
lib: self.inner.lib.clone(),
kind: DataKind::Memory,
bytes: Pin::new(vec![]),
inner: core::ptr::NonNull::new(plain)
inner: std::ptr::NonNull::new(plain)
.ok_or_else(|| Error::new("internal libgpgme error").set_kind(ErrorKind::Bug))?,
};
@ -1043,7 +1043,7 @@ impl Context {
lib: self.inner.lib.clone(),
kind: DataKind::Memory,
bytes: Pin::new(vec![]),
inner: core::ptr::NonNull::new(cipher)
inner: std::ptr::NonNull::new(cipher)
.ok_or_else(|| Error::new("internal libgpgme error").set_kind(ErrorKind::Bug))?,
};
@ -1165,7 +1165,7 @@ enum DataKind {
#[derive(Debug)]
pub struct Data {
inner: core::ptr::NonNull<bindings::gpgme_data>,
inner: std::ptr::NonNull<bindings::gpgme_data>,
kind: DataKind,
#[allow(dead_code)]
bytes: std::pin::Pin<Vec<u8>>,
@ -1221,7 +1221,7 @@ impl AsRawFd for GpgmeFd {
#[derive(Clone)]
struct KeyInner {
inner: core::ptr::NonNull<_gpgme_key>,
inner: std::ptr::NonNull<_gpgme_key>,
}
unsafe impl Send for KeyInner {}

View File

@ -41,8 +41,8 @@ impl TryFrom<i64> for ModSequence {
}
}
impl core::fmt::Display for ModSequence {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Display for ModSequence {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "{}", &self.0)
}
}
@ -55,7 +55,7 @@ pub struct CachedEnvelope {
pub modsequence: Option<ModSequence>,
}
pub trait ImapCache: Send + core::fmt::Debug {
pub trait ImapCache: Send + std::fmt::Debug {
fn reset(&mut self) -> Result<()>;
fn mailbox_state(&mut self, mailbox_hash: MailboxHash) -> Result<Option<()>>;
@ -94,7 +94,7 @@ pub trait ImapCache: Send + core::fmt::Debug {
) -> Result<Option<Vec<u8>>>;
}
pub trait ImapCacheReset: Send + core::fmt::Debug {
pub trait ImapCacheReset: Send + std::fmt::Debug {
fn reset_db(uid_store: &UIDStore) -> Result<()>
where
Self: Sized;

View File

@ -19,7 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use std::{fmt, sync::Arc};
use std::sync::Arc;
use imap_codec::{
command::{AppendError, CopyError, ListError},
@ -56,7 +56,7 @@ impl From<SequenceSetError> for Error {
impl<S, L> From<AppendError<S, L>> for Error
where
AppendError<S, L>: fmt::Debug + fmt::Display + Sync + Send + 'static,
AppendError<S, L>: std::fmt::Debug + std::fmt::Display + Sync + Send + 'static,
{
#[inline]
fn from(error: AppendError<S, L>) -> Self {
@ -71,7 +71,7 @@ where
impl<S, L> From<CopyError<S, L>> for Error
where
CopyError<S, L>: fmt::Debug + fmt::Display + Sync + Send + 'static,
CopyError<S, L>: std::fmt::Debug + std::fmt::Display + Sync + Send + 'static,
{
#[inline]
fn from(error: CopyError<S, L>) -> Self {
@ -86,7 +86,7 @@ where
impl<S, M> From<MoveError<S, M>> for Error
where
MoveError<S, M>: fmt::Debug + fmt::Display + Sync + Send + 'static,
MoveError<S, M>: std::fmt::Debug + std::fmt::Display + Sync + Send + 'static,
{
#[inline]
fn from(error: MoveError<S, M>) -> Self {
@ -101,7 +101,7 @@ where
impl<L1, L2> From<ListError<L1, L2>> for Error
where
ListError<L1, L2>: fmt::Debug + fmt::Display + Sync + Send + 'static,
ListError<L1, L2>: std::fmt::Debug + std::fmt::Display + Sync + Send + 'static,
{
#[inline]
fn from(error: ListError<L1, L2>) -> Self {

View File

@ -19,8 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use core::marker::PhantomData;
use std::collections::HashMap;
use std::{collections::HashMap, marker::PhantomData};
use serde::de::{Deserialize, Deserializer};
use serde_json::{value::RawValue, Value};

View File

@ -19,7 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use core::marker::PhantomData;
use std::marker::PhantomData;
use super::*;

View File

@ -19,9 +19,9 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use core::marker::PhantomData;
use std::{
hash::{Hash, Hasher},
marker::PhantomData,
sync::Arc,
};
@ -55,7 +55,7 @@ pub struct Id<OBJ> {
pub _ph: PhantomData<fn() -> OBJ>,
}
impl<OBJ: Object> core::fmt::Debug for Id<OBJ> {
impl<OBJ: Object> std::fmt::Debug for Id<OBJ> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_tuple(&format!("Id<{}>", OBJ::NAME))
.field(&self.inner)
@ -63,7 +63,7 @@ impl<OBJ: Object> core::fmt::Debug for Id<OBJ> {
}
}
impl core::fmt::Debug for Id<String> {
impl std::fmt::Debug for Id<String> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_tuple("Id<Any>").field(&self.inner).finish()
}
@ -108,9 +108,9 @@ impl<OBJ> From<String> for Id<OBJ> {
}
}
impl<OBJ> core::fmt::Display for Id<OBJ> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Display::fmt(&self.inner, fmt)
impl<OBJ> std::fmt::Display for Id<OBJ> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Display::fmt(&self.inner, fmt)
}
}
@ -182,9 +182,9 @@ impl<OBJ> From<String> for State<OBJ> {
}
}
impl<OBJ> core::fmt::Display for State<OBJ> {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Display::fmt(&self.inner, fmt)
impl<OBJ> std::fmt::Display for State<OBJ> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Display::fmt(&self.inner, fmt)
}
}
@ -940,8 +940,8 @@ pub enum SetError {
StateMismatch(Option<String>),
}
impl core::fmt::Display for SetError {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Display for SetError {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
use SetError::*;
match self {
Forbidden(Some(description)) => write!(fmt, "Forbidden: {}", description),

View File

@ -201,8 +201,8 @@ impl BytesDisplay {
pub const PETABYTE: f64 = Self::GIGABYTE * 1024.0;
}
impl core::fmt::Display for BytesDisplay {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
impl std::fmt::Display for BytesDisplay {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
let bytes: f64 = self.0 as f64;
if bytes == 0.0 {
write!(fmt, "0")

View File

@ -206,8 +206,7 @@ impl MailBackend for MaildirType {
fn fetch(
&mut self,
mailbox_hash: MailboxHash,
) -> Result<core::pin::Pin<Box<dyn Stream<Item = Result<Vec<Envelope>>> + Send + 'static>>>
{
) -> Result<std::pin::Pin<Box<dyn Stream<Item = Result<Vec<Envelope>>> + Send + 'static>>> {
let mailbox: &MaildirMailbox = &self.mailboxes[&mailbox_hash];
let unseen = mailbox.unseen.clone();
let total = mailbox.total.clone();

View File

@ -19,10 +19,11 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>.
*/
use core::{future::Future, pin::Pin};
use std::{
future::Future,
io::{self, Read},
path::PathBuf,
pin::Pin,
sync::{Arc, Mutex},
};