Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚰️ zb: remove unused arg0namespace from match rule #428

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion book-1.0/src/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ Let see how to use it:

```rust,no_run
# use std::error::Error;
# use std::convert::TryInto;
# use zbus::{dbus_interface, fdo};
#
struct Greeter;
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use nix::unistd::Uid;
use std::net::{SocketAddr, TcpStream, ToSocketAddrs};
#[cfg(all(unix, not(feature = "tokio")))]
use std::os::unix::net::UnixStream;
use std::{collections::HashMap, convert::TryFrom, env, str::FromStr};
use std::{collections::HashMap, env, str::FromStr};
#[cfg(feature = "tokio")]
use tokio::net::TcpStream;
#[cfg(all(unix, feature = "tokio"))]
Expand Down
1 change: 0 additions & 1 deletion zbus/src/blocking/connection/builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use static_assertions::assert_impl_all;
use std::convert::TryInto;
#[cfg(not(feature = "tokio"))]
use std::net::TcpStream;
#[cfg(all(unix, not(feature = "tokio")))]
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/blocking/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use enumflags2::BitFlags;
use event_listener::EventListener;
use static_assertions::assert_impl_all;
use std::{convert::TryInto, io, ops::Deref, sync::Arc};
use std::{io, ops::Deref, sync::Arc};
use zbus_names::{BusName, ErrorName, InterfaceName, MemberName, OwnedUniqueName, WellKnownName};
use zvariant::ObjectPath;

Expand Down
2 changes: 1 addition & 1 deletion zbus/src/blocking/message_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use futures_util::StreamExt;
use static_assertions::assert_impl_all;
use std::{convert::TryInto, sync::Arc};
use std::sync::Arc;

use crate::{
blocking::Connection, message::Message, utils::block_on, MatchRule, OwnedMatchRule, Result,
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/blocking/object_server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! The object server API.

use std::{convert::TryInto, ops::Deref};
use std::ops::Deref;

use static_assertions::assert_impl_all;
use zvariant::ObjectPath;
Expand Down
2 changes: 0 additions & 2 deletions zbus/src/blocking/proxy/builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use static_assertions::assert_impl_all;
use zbus_names::{BusName, InterfaceName};
use zvariant::ObjectPath;
Expand Down
6 changes: 1 addition & 5 deletions zbus/src/blocking/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
use enumflags2::BitFlags;
use futures_util::StreamExt;
use static_assertions::assert_impl_all;
use std::{
convert::{TryFrom, TryInto},
ops::Deref,
sync::Arc,
};
use std::{ops::Deref, sync::Arc};
use zbus_names::{BusName, InterfaceName, MemberName, UniqueName};
use zvariant::{ObjectPath, OwnedValue, Value};

Expand Down
1 change: 0 additions & 1 deletion zbus/src/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::net::TcpStream;
use std::os::unix::net::UnixStream;
use std::{
collections::{HashMap, HashSet, VecDeque},
convert::TryInto,
sync::Arc,
};
#[cfg(feature = "tokio")]
Expand Down
1 change: 0 additions & 1 deletion zbus/src/connection/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use futures_util::{future::poll_fn, StreamExt};
use nix::unistd::Uid;
use std::{
collections::VecDeque,
convert::{TryFrom, TryInto},
fmt::{self, Debug},
path::PathBuf,
str::FromStr,
Expand Down
1 change: 0 additions & 1 deletion zbus/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use ordered_stream::{OrderedFuture, OrderedStream, PollResult};
use static_assertions::assert_impl_all;
use std::{
collections::HashMap,
convert::TryInto,
io::{self, ErrorKind},
ops::Deref,
pin::Pin,
Expand Down
1 change: 0 additions & 1 deletion zbus/src/fdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,6 @@ mod tests {
use crate::{fdo, message::Message, DBusError, Error};
use futures_util::StreamExt;
use ntest::timeout;
use std::convert::TryInto;
use test_log::test;
use tokio::runtime;
use zbus_names::WellKnownName;
Expand Down
1 change: 0 additions & 1 deletion zbus/src/guid.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
borrow::{Borrow, BorrowMut},
convert::{TryFrom, TryInto},
fmt,
iter::repeat_with,
ops::{Deref, DerefMut},
Expand Down
1 change: 0 additions & 1 deletion zbus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ use zvariant::OwnedFd;
mod tests {
use std::{
collections::HashMap,
convert::{TryFrom, TryInto},
sync::{mpsc::channel, Arc, Condvar, Mutex},
};
#[cfg(unix)]
Expand Down
6 changes: 1 addition & 5 deletions zbus/src/match_rule/builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::{TryFrom, TryInto};

use static_assertions::assert_impl_all;

use crate::{
Expand Down Expand Up @@ -257,8 +255,7 @@ impl<'m> Builder<'m> {
return Err(Error::InvalidMatchRule);
}

self.0.arg0ns = Some(namespace.clone());
self.0.arg0namespace = InterfaceName::try_from(namespace).ok();
self.0.arg0ns = Some(namespace);

Ok(self)
}
Expand All @@ -274,7 +271,6 @@ impl<'m> Builder<'m> {
destination: None,
args: Vec::with_capacity(MAX_ARGS as usize),
arg_paths: Vec::with_capacity(MAX_ARGS as usize),
arg0namespace: None,
arg0ns: None,
})
}
Expand Down
5 changes: 1 addition & 4 deletions zbus/src/match_rule/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Bus match rule API.

use core::panic;
use std::{convert::TryFrom, ops::Deref};
use std::ops::Deref;

use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
Expand Down Expand Up @@ -97,7 +97,6 @@ pub struct MatchRule<'m> {
pub(crate) destination: Option<UniqueName<'m>>,
pub(crate) args: Vec<(u8, Str<'m>)>,
pub(crate) arg_paths: Vec<(u8, ObjectPath<'m>)>,
pub(crate) arg0namespace: Option<InterfaceName<'m>>,
pub(crate) arg0ns: Option<Str<'m>>,
}

Expand Down Expand Up @@ -169,7 +168,6 @@ impl<'m> MatchRule<'m> {
.iter()
.map(|(i, p)| (*i, p.to_owned()))
.collect(),
arg0namespace: self.arg0namespace.as_ref().map(|a| a.to_owned()),
arg0ns: self.arg0ns.as_ref().map(|a| a.to_owned()),
}
}
Expand All @@ -193,7 +191,6 @@ impl<'m> MatchRule<'m> {
.into_iter()
.map(|(i, p)| (i, p.into_owned()))
.collect(),
arg0namespace: self.arg0namespace.map(|a| a.into_owned()),
arg0ns: self.arg0ns.map(|a| a.into_owned()),
}
}
Expand Down
5 changes: 1 addition & 4 deletions zbus/src/message/builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
convert::{Into, TryInto},
io::{Cursor, Write},
};
use std::io::{Cursor, Write};

#[cfg(unix)]
use crate::message::Fds;
Expand Down
2 changes: 0 additions & 2 deletions zbus/src/message/field.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use serde::{
de::{Deserialize, Deserializer, Error},
ser::{Serialize, Serializer},
Expand Down
1 change: 0 additions & 1 deletion zbus/src/message/fields.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use serde::{Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::convert::{TryFrom, TryInto};
use zbus_names::{InterfaceName, MemberName};
use zvariant::{ObjectPath, Type};

Expand Down
8 changes: 1 addition & 7 deletions zbus/src/message/header.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryFrom;

use enumflags2::{bitflags, BitFlags};
use once_cell::sync::OnceCell;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -382,11 +380,7 @@ impl<'m> Header<'m> {
mod tests {
use crate::message::{Field, Fields, Header, PrimaryHeader, Type};

use std::{
convert::{TryFrom, TryInto},
error::Error,
result::Result,
};
use std::{error::Error, result::Result};
use test_log::test;
use zbus_names::{InterfaceName, MemberName};
use zvariant::{ObjectPath, Signature};
Expand Down
6 changes: 1 addition & 5 deletions zbus/src/message/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
//! D-Bus Message.
use std::{
convert::{Into, TryFrom, TryInto},
fmt,
io::Cursor,
};
use std::{fmt, io::Cursor};

#[cfg(unix)]
use std::{
Expand Down
1 change: 0 additions & 1 deletion zbus/src/message_stream.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::TryInto,
pin::Pin,
sync::Arc,
task::{Context, Poll},
Expand Down
1 change: 0 additions & 1 deletion zbus/src/object_server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use event_listener::{Event, EventListener};
use serde::Serialize;
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
convert::TryInto,
fmt::Write,
marker::PhantomData,
ops::{Deref, DerefMut},
Expand Down
1 change: 0 additions & 1 deletion zbus/src/object_server/signal_context.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use zbus_names::BusName;

use crate::{zvariant::ObjectPath, Connection, Error, Result};
use std::convert::TryInto;

/// A signal emission context.
///
Expand Down
2 changes: 1 addition & 1 deletion zbus/src/proxy/builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashSet, convert::TryInto, marker::PhantomData, sync::Arc};
use std::{collections::HashSet, marker::PhantomData, sync::Arc};

use static_assertions::assert_impl_all;
use zbus_names::{BusName, InterfaceName};
Expand Down
1 change: 0 additions & 1 deletion zbus/src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use ordered_stream::{join as join_streams, FromFuture, Join, OrderedStream, Poll
use static_assertions::assert_impl_all;
use std::{
collections::{HashMap, HashSet},
convert::{TryFrom, TryInto},
future::Future,
ops::Deref,
pin::Pin,
Expand Down
1 change: 0 additions & 1 deletion zbus/src/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use quick_xml::{de::Deserializer, se::to_writer};
use serde::{Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
convert::{TryFrom, TryInto},
io::{BufReader, Read, Write},
result::Result,
};
Expand Down
2 changes: 1 addition & 1 deletion zbus/tests/e2e.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::disallowed_names)]
use std::collections::HashMap;
#[cfg(all(unix, not(feature = "tokio")))]
use std::os::unix::net::UnixStream;
use std::{collections::HashMap, convert::TryInto};
#[cfg(all(unix, feature = "tokio"))]
use tokio::net::UnixStream;

Expand Down
5 changes: 1 addition & 4 deletions zbus/tests/xml.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#![cfg(feature = "xml")]

use quick_xml::de::DeError;
use std::{
convert::{TryFrom, TryInto},
error::Error,
};
use std::error::Error;
use test_log::test;

use zbus::xml::{ArgDirection, Node};
Expand Down
2 changes: 1 addition & 1 deletion zbus_macros/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use futures_util::{
future::{select, Either},
stream::StreamExt,
};
use std::{convert::TryInto, future::ready};
use std::future::ready;
use zbus::{block_on, fdo, object_server::SignalContext, proxy::CacheProperties};
use zbus_macros::{dbus_interface, dbus_proxy, DBusError};

Expand Down
3 changes: 1 addition & 2 deletions zbus_names/src/bus_name.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use core::{
borrow::Borrow,
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
};
use std::{borrow::Cow, convert::TryInto, sync::Arc};
use std::{borrow::Cow, sync::Arc};

use crate::{Error, OwnedUniqueName, OwnedWellKnownName, Result, UniqueName, WellKnownName};
use serde::{de, Deserialize, Serialize};
Expand Down
1 change: 0 additions & 1 deletion zbus_names/src/error_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
borrow::{Borrow, Cow},
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion zbus_names/src/interface_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
borrow::{Borrow, Cow},
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion zbus_names/src/member_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
borrow::{Borrow, Cow},
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion zbus_names/src/unique_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
borrow::{Borrow, Cow},
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion zbus_names/src/well_known_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use serde::{de, Deserialize, Serialize};
use static_assertions::assert_impl_all;
use std::{
borrow::{Borrow, Cow},
convert::TryFrom,
fmt::{self, Display, Formatter},
ops::Deref,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion zbus_xmlgen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![deny(rust_2018_idioms)]

use std::{
convert::TryInto,
env::args,
error::Error,
fs::File,
Expand Down
5 changes: 1 addition & 4 deletions zvariant/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ use serde::{
ser::{Serialize, SerializeSeq, Serializer},
};
use static_assertions::assert_impl_all;
use std::{
convert::{TryFrom, TryInto},
fmt::{Display, Write},
};
use std::fmt::{Display, Write};

use crate::{
value::{value_display_fmt, SignatureSeed},
Expand Down
5 changes: 1 addition & 4 deletions zvariant/src/complete_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use core::{
convert::TryFrom,
fmt::{self, Debug, Display, Formatter},
};
use core::fmt::{self, Debug, Display, Formatter};
use serde::de::{Deserialize, Deserializer};
use static_assertions::assert_impl_all;

Expand Down
2 changes: 0 additions & 2 deletions zvariant/src/dbus/de.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::convert::TryFrom;

use serde::de::{self, DeserializeSeed, EnumAccess, MapAccess, SeqAccess, Visitor};
use static_assertions::assert_impl_all;

Expand Down
1 change: 0 additions & 1 deletion zvariant/src/dict.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
collections::HashMap,
convert::TryFrom,
fmt::{Display, Write},
hash::BuildHasher,
};
Expand Down
2 changes: 1 addition & 1 deletion zvariant/src/from_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
#[cfg(unix)]
use crate::Fd;

use std::{collections::HashMap, convert::TryFrom, hash::BuildHasher};
use std::{collections::HashMap, hash::BuildHasher};

macro_rules! value_try_from {
($kind:ident, $to:ty) => {
Expand Down
Loading