Skip to content

Commit

Permalink
[rust] Remove unused imports
Browse files Browse the repository at this point in the history
The latest rustc nightly is much better at detecting unused imports.
This will unblock updating the rust toolchain.

Change-Id: Ia81c850ea43de0a1687cb6a11910e850823642eb
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/941868
Fuchsia-Auto-Submit: Erick Tryzelaar <etryzelaar@google.com>
Reviewed-by: Drew Fisher <zarvox@google.com>
Owners-Override: Kevin Lindkvist <lindkvist@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Kevin Lindkvist <lindkvist@google.com>
Reviewed-by: Gary Bressler <geb@google.com>
  • Loading branch information
erickt authored and Rebase bot committed Nov 7, 2023
1 parent 8dd7944 commit 019927d
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ mod thread_to_host;
#[cfg(test)]
mod tests;

pub use border_agent::*;
pub use connectivity_state::*;
pub use convert::*;
use driver_state::*;
pub use error_adapter::*;
pub use host_to_thread::*;
use lowpan_driver_common::net::{BackboneInterface, NetworkInterface};
use lowpan_driver_common::AsyncCondition;
use multicast_routing_manager::MulticastRoutingManager;
pub use nat64::*;
pub use srp_proxy::*;
pub use thread_to_host::*;

const DEFAULT_SCAN_DWELL_TIME_MS: u32 = 200;

Expand Down
1 change: 0 additions & 1 deletion src/connectivity/lowpan/lib/lowpan_driver_common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ rustc_library("lowpan_driver_common") {
"//sdk/fidl/fuchsia.net.stack:fuchsia.net.stack_rust",
"//sdk/fidl/fuchsia.net.tun:fuchsia.net.tun_rust",
"//src/connectivity/lib/fidl_fuchsia_net_stack_ext",
"//src/connectivity/lib/net-declare",
"//src/connectivity/lib/net-types",
"//src/connectivity/lib/packet-formats",
"//src/connectivity/lowpan/lib/openthread_sys",
Expand Down
7 changes: 0 additions & 7 deletions src/connectivity/lowpan/lib/lowpan_driver_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ pub(crate) mod prelude_internal {
pub use crate::{ZxResult, ZxStatus};
pub use anyhow::{format_err, Context as _};
pub use async_trait::async_trait;
pub use fasync::TimeoutExt as _;
pub use fidl_fuchsia_net_ext as fnet_ext;
pub use fuchsia_async as fasync;

pub use net_declare::{fidl_ip, fidl_ip_v6};

pub use crate::pii::MarkPii;
}

pub mod lowpan_fidl {
Expand Down
2 changes: 0 additions & 2 deletions src/fonts/offset_string/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use {

mod conversions;

pub use crate::conversions::*;

/// A compact representation of a set of unsigned integer ranges.
///
/// The primary use case is succinctly encoding a large set of Unicode code points in JSON.
Expand Down
5 changes: 4 additions & 1 deletion src/fonts/src/font_service/asset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ mod loader;

pub use {
asset::{Asset, AssetId},
collection::{AssetCollection, AssetCollectionBuilder, AssetCollectionError},
collection::{AssetCollection, AssetCollectionBuilder},
loader::{AssetLoader, AssetLoaderImpl},
};

#[cfg(test)]
pub(crate) use collection::AssetCollectionError;
2 changes: 1 addition & 1 deletion src/fonts/src/font_service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use {
};

pub use {
asset::{AssetId, AssetLoader, AssetLoaderImpl},
asset::{AssetId, AssetLoader},
builder::FontServiceBuilder,
};

Expand Down
9 changes: 2 additions & 7 deletions src/fonts/tests/integration/src/experimental_api/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
// found in the LICENSE file

pub use {
crate::util,
crate::FONTS_EPHEMERAL_CM,
anyhow::{Context as _, Error},
fidl::endpoints::create_proxy,
fidl_fuchsia_fonts as fonts, fidl_fuchsia_fonts_experimental as fonts_exp,
fidl_fuchsia_intl::LocaleId,
crate::util, anyhow::Error, fidl::endpoints::create_proxy, fidl_fuchsia_fonts as fonts,
fidl_fuchsia_fonts_experimental as fonts_exp, fidl_fuchsia_intl::LocaleId,
fuchsia_async as fasync,
futures::lock::Mutex,
};

pub type ProviderFactory = util::TypedProviderFactory<fonts_exp::ProviderMarker>;
Expand Down
2 changes: 0 additions & 2 deletions src/fonts/tests/integration/src/reviewed_api/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

pub use {
crate::util,
crate::FONTS_ALIASED_CM,
anyhow::{Context as _, Error},
fidl_fuchsia_fonts as fonts, fidl_fuchsia_intl as intl, fuchsia_async as fasync,
fuchsia_component_test::ScopedInstance,
fuchsia_zircon as zx,
fuchsia_zircon::AsHandleRef,
};
Expand Down
4 changes: 1 addition & 3 deletions src/lib/fuchsia-async/src/runtime/fuchsia/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ mod time;

pub use common::EHandle;
pub use local::{LocalExecutor, TestExecutor};
pub use packets::{
need_signal_or_peer_closed, schedule_packet, PacketReceiver, ReceiverRegistration,
};
pub use packets::{need_signal_or_peer_closed, PacketReceiver, ReceiverRegistration};
pub use send::SendExecutor;
pub use time::{Duration, Time};
2 changes: 0 additions & 2 deletions src/lib/intl/unicode_utils/char_collection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ mod operators;

pub use char_collection::CharCollection;
pub use char_collection::MultiCharRange;
pub use conversions::*;
pub use operators::*;
9 changes: 4 additions & 5 deletions src/lib/mundane/src/boringssl/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
//! (e.g., `void` functions).
pub use bssl_sys::{
CBB_cleanup, CBB_len, CBS_init, CBS_len, CRYPTO_memcmp, EC_GROUP_get_curve_name,
ED25519_keypair, ED25519_keypair_from_seed, ERR_print_errors_cb, HMAC_CTX_init, HMAC_size,
RC4_set_key, RSA_bits, RC4,
CBB_len, CBS_init, CBS_len, CRYPTO_memcmp, EC_GROUP_get_curve_name, ED25519_keypair,
ED25519_keypair_from_seed, ERR_print_errors_cb, HMAC_CTX_init, HMAC_size, RC4_set_key,
RSA_bits, RC4,
};

use std::convert::TryInto;
Expand Down Expand Up @@ -207,8 +207,7 @@ pub unsafe fn ECDSA_sign(
#[allow(non_snake_case)]
#[must_use]
pub unsafe fn ECDSA_size(key: *const EC_KEY) -> Result<NonZeroUsize, BoringError> {
NonZeroUsize::new(ffi::ECDSA_size(key))
.ok_or_else(|| BoringError::consume_stack("ECDSA_size"))
NonZeroUsize::new(ffi::ECDSA_size(key)).ok_or_else(|| BoringError::consume_stack("ECDSA_size"))
}

#[allow(non_snake_case)]
Expand Down
19 changes: 11 additions & 8 deletions src/lib/usb_rs/src/usb_linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod usbdevice_fs;
use usbdevice_fs::*;
mod discovery;
pub use discovery::{wait_for_devices, DeviceStream};
pub use discovery::wait_for_devices;

use futures::future::poll_fn;
use futures::task::AtomicWaker;
Expand Down Expand Up @@ -455,11 +455,14 @@ impl Interface {
continue;
}

let Some((id, urb)) = inner.urbs.iter().enumerate().find(
|(_, urb)| std::ptr::eq(urb.urb.get(), out_ptr)
) else {
panic!("Reap'd URB we did not sow!");
};
let Some((id, urb)) = inner
.urbs
.iter()
.enumerate()
.find(|(_, urb)| std::ptr::eq(urb.urb.get(), out_ptr))
else {
panic!("Reap'd URB we did not sow!");
};

let count = urb.refs.fetch_sub(1, Ordering::Relaxed);
urb.waker.wake();
Expand Down Expand Up @@ -676,8 +679,8 @@ mod test {
let mut buffers = self.endpoint_buffers.lock().unwrap();
buffers.get_mut(&address).and_then(|x| {
let EndpointBuffer::Data(x) = x else {
panic!("Target read from buffer with host reads waiting");
};
panic!("Target read from buffer with host reads waiting");
};
x.pop_back()
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/starnix/kernel/fs/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ mod tests {
use crate::{
fs::{
buffers::{VecInputBuffer, VecOutputBuffer},
eventfd::{new_eventfd, EventFdType},
fuchsia::create_fuchsia_pipe,
new_eventfd,
pipe::new_pipe,
socket::{SocketDomain, SocketType, UnixSocket},
EventFdType, FdEvents,
FdEvents,
},
task::Waiter,
testing::{create_kernel_and_task, create_task},
Expand Down
5 changes: 3 additions & 2 deletions src/starnix/kernel/fs/fuchsia/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ use crate::{
mm::ProtectionFlags,
syscalls::{SyscallArg, SyscallResult},
task::{CurrentTask, EventHandler, Kernel, WaitCanceler, Waiter},
types::errno::errno,
types::{
errno, error, from_status_like_fdio, fsverity_descriptor, ino_t, off_t, statfs, DeviceType,
Errno, FileMode, MountFlags, OpenFlags,
error, from_status_like_fdio, fsverity_descriptor, ino_t, off_t, statfs, DeviceType, Errno,
FileMode, MountFlags, OpenFlags,
},
vmex_resource::VMEX_RESOURCE,
};
Expand Down
3 changes: 1 addition & 2 deletions src/starnix/kernel/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ pub use directory_file::*;
pub use dirent_sink::*;
pub use dynamic_file::*;
pub use epoll::*;
pub use eventfd::*;
pub use fd_events::*;
pub use fd_events::FdEvents;
pub use fd_number::*;
pub use fd_table::*;
pub use file_object::*;
Expand Down
3 changes: 2 additions & 1 deletion src/starnix/kernel/task/waiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,9 @@ mod tests {
use crate::{
fs::{
buffers::{VecInputBuffer, VecOutputBuffer},
eventfd::{new_eventfd, EventFdType},
fuchsia::*,
new_eventfd, EventFdType, FdEvents,
FdEvents,
},
testing::*,
};
Expand Down
36 changes: 10 additions & 26 deletions src/starnix/kernel/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,20 @@ pub use user_buffer::*;

// Manually export names that are ambiguous between the name below and the one defined in uapi.
pub use auth::{
CAP_AUDIT_CONTROL, CAP_AUDIT_READ, CAP_AUDIT_WRITE, CAP_BLOCK_SUSPEND, CAP_BPF,
CAP_CHECKPOINT_RESTORE, CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER,
CAP_FSETID, CAP_IPC_LOCK, CAP_IPC_OWNER, CAP_KILL, CAP_LEASE, CAP_LINUX_IMMUTABLE,
CAP_MAC_ADMIN, CAP_MAC_OVERRIDE, CAP_MKNOD, CAP_NET_ADMIN, CAP_NET_BIND_SERVICE,
CAP_NET_BROADCAST, CAP_NET_RAW, CAP_PERFMON, CAP_SETFCAP, CAP_SETGID, CAP_SETPCAP, CAP_SETUID,
CAP_SYSLOG, CAP_SYS_ADMIN, CAP_SYS_BOOT, CAP_SYS_CHROOT, CAP_SYS_MODULE, CAP_SYS_NICE,
CAP_SYS_PACCT, CAP_SYS_PTRACE, CAP_SYS_RAWIO, CAP_SYS_RESOURCE, CAP_SYS_TIME,
CAP_SYS_TTY_CONFIG, CAP_WAKE_ALARM,
CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER, CAP_FSETID, CAP_KILL,
CAP_LINUX_IMMUTABLE, CAP_MAC_OVERRIDE, CAP_MKNOD, CAP_NET_ADMIN, CAP_NET_RAW, CAP_SETGID,
CAP_SETPCAP, CAP_SETUID, CAP_SYS_ADMIN, CAP_SYS_BOOT, CAP_SYS_CHROOT, CAP_SYS_NICE,
CAP_SYS_PTRACE, CAP_SYS_RESOURCE, CAP_WAKE_ALARM,
};

pub use errno::{
E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EADV, EAFNOSUPPORT, EAGAIN, EALREADY, EBADE, EBADF,
EBADFD, EBADMSG, EBADR, EBADRQC, EBADSLT, EBFONT, EBUSY, ECANCELED, ECHILD, ECHRNG, ECOMM,
ECONNABORTED, ECONNREFUSED, ECONNRESET, EDEADLK, EDEADLOCK, EDESTADDRREQ, EDOM, EDOTDOT,
EDQUOT, EEXIST, EFAULT, EFBIG, EHOSTDOWN, EHOSTUNREACH, EHWPOISON, EIDRM, EILSEQ, EINPROGRESS,
EINTR, EINVAL, EIO, EISCONN, EISDIR, EISNAM, EKEYEXPIRED, EKEYREJECTED, EKEYREVOKED, EL2HLT,
EL2NSYNC, EL3HLT, EL3RST, ELIBACC, ELIBBAD, ELIBEXEC, ELIBMAX, ELIBSCN, ELNRNG, ELOOP,
EMEDIUMTYPE, EMFILE, EMLINK, EMSGSIZE, EMULTIHOP, ENAMETOOLONG, ENAVAIL, ENETDOWN, ENETRESET,
ENETUNREACH, ENFILE, ENOANO, ENOBUFS, ENOCSI, ENODATA, ENODEV, ENOENT, ENOEXEC, ENOKEY, ENOLCK,
ENOLINK, ENOMEDIUM, ENOMEM, ENOMSG, ENONET, ENOPKG, ENOPROTOOPT, ENOSPC, ENOSR, ENOSTR, ENOSYS,
ENOTBLK, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTNAM, ENOTRECOVERABLE, ENOTSOCK, ENOTTY, ENOTUNIQ,
ENXIO, EOPNOTSUPP, EOVERFLOW, EOWNERDEAD, EPERM, EPFNOSUPPORT, EPIPE, EPROTO, EPROTONOSUPPORT,
EPROTOTYPE, ERANGE, EREMCHG, EREMOTE, EREMOTEIO, ERESTART, ERFKILL, EROFS, ESHUTDOWN,
ESOCKTNOSUPPORT, ESPIPE, ESRCH, ESRMNT, ESTALE, ESTRPIPE, ETIME, ETIMEDOUT, ETOOMANYREFS,
ETXTBSY, EUCLEAN, EUNATCH, EUSERS, EWOULDBLOCK, EXDEV, EXFULL,
EACCES, EAGAIN, EBADF, EEXIST, EINPROGRESS, EINTR, EINVAL, ENAMETOOLONG, ENOENT, ENOSPC,
ENOSYS, ENOTDIR, EPERM, ETIMEDOUT,
};

pub use signals::{
SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGIO, SIGIOT,
SIGKILL, SIGPIPE, SIGPROF, SIGPWR, SIGQUIT, SIGRTMIN, SIGSEGV, SIGSTKFLT, SIGSTOP, SIGSYS,
SIGTERM, SIGTRAP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGUSR1, SIGUSR2, SIGVTALRM, SIGWINCH,
SIGXCPU, SIGXFSZ,
SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGIO, SIGKILL,
SIGPIPE, SIGPROF, SIGPWR, SIGQUIT, SIGRTMIN, SIGSEGV, SIGSTKFLT, SIGSTOP, SIGSYS, SIGTERM,
SIGTRAP, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGUSR1, SIGUSR2, SIGVTALRM, SIGWINCH, SIGXCPU,
SIGXFSZ,
};
3 changes: 1 addition & 2 deletions src/sys/lib/component_debug/src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ fn add_report(report: RouteReport, table: &mut Table) {
mod test {
use {
super::*, assert_matches::assert_matches, fidl::endpoints, fuchsia_async as fasync,
futures::TryStreamExt,
moniker::MonikerBase,
futures::TryStreamExt, moniker::MonikerBase,
};

fn route_validator(
Expand Down
2 changes: 1 addition & 1 deletion src/virtualization/bin/vmm/device/virtio_mem/src/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use zerocopy::{AsBytes, FromBytes, FromZeroes};

pub use zerocopy::byteorder::little_endian::{U16 as LE16, U32 as LE32, U64 as LE64};
pub use zerocopy::byteorder::little_endian::{U16 as LE16, U64 as LE64};

// 5.15.1 Virtqueues
//
Expand Down

0 comments on commit 019927d

Please sign in to comment.