Skip to content

Commit

Permalink
chore: fix unused_import lints
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbz00 committed Apr 5, 2024
1 parent 832b9b6 commit 7157f96
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 12 deletions.
1 change: 0 additions & 1 deletion prost-derive/src/field/scalar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::fmt;

use anyhow::{anyhow, bail, Error};
Expand Down
6 changes: 3 additions & 3 deletions src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use alloc::format;
use alloc::string::String;
use alloc::vec::Vec;
use core::cmp::min;
use core::convert::TryFrom;
use core::mem;
use core::str;
use core::u32;
Expand Down Expand Up @@ -1423,15 +1422,16 @@ pub mod btree_map {

#[cfg(test)]
mod test {
#[cfg(not(feature = "std"))]
use alloc::string::ToString;
use core::borrow::Borrow;
use core::fmt::Debug;
use core::u64;

use ::bytes::{Bytes, BytesMut};
use ::bytes::BytesMut;
use proptest::{prelude::*, test_runner::TestCaseResult};

use crate::encoding::*;
use super::*;

pub fn check_type<T, B>(
value: T,
Expand Down
2 changes: 2 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! Protobuf encoding and decoding errors.

use alloc::borrow::Cow;
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use core::fmt;
Expand Down
3 changes: 2 additions & 1 deletion src/message.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use core::fmt::Debug;
use core::usize;

use bytes::{Buf, BufMut};

Expand Down
2 changes: 2 additions & 0 deletions src/name.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Support for associating type name information with a [`Message`].

use crate::Message;

#[cfg(not(feature = "std"))]
use alloc::{format, string::String};

/// Associate a type name with a [`Message`] type.
Expand Down
2 changes: 2 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
//! the `prost-types` crate in order to avoid a cyclic dependency between `prost` and
//! `prost-build`.

#[cfg(not(feature = "std"))]
use alloc::string::String;
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use ::bytes::{Buf, BufMut, Bytes};
Expand Down
4 changes: 3 additions & 1 deletion tests/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
//! The tests check against expected output. This may be a bit fragile, but it is likely OK for
//! actual use.

use prost::alloc::{format, string::String};
use prost::alloc::format;
#[cfg(not(feature = "std"))]
use prost::alloc::string::String;

// Borrow some types from other places.
#[cfg(feature = "std")]
Expand Down
1 change: 1 addition & 0 deletions tests/src/deprecated_field.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(not(feature = "std"))]
use alloc::string::ToString;

mod deprecated_field {
Expand Down
6 changes: 3 additions & 3 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub mod default_string_escape {
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
}

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

use anyhow::anyhow;
Expand Down Expand Up @@ -278,11 +279,10 @@ where
#[cfg(test)]
mod tests {

use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::collections::{BTreeMap, BTreeSet};
use alloc::string::ToString;
use alloc::vec;
#[cfg(not(feature = "std"))]
use alloc::{borrow::ToOwned, boxed::Box, string::ToString};

use super::*;

Expand Down
5 changes: 4 additions & 1 deletion tests/src/message_encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use prost::alloc::{borrow::ToOwned, string::String, vec, vec::Vec};
use prost::alloc::vec;
#[cfg(not(feature = "std"))]
use prost::alloc::{borrow::ToOwned, string::String, vec::Vec};

use prost::bytes::Bytes;
use prost::{Enumeration, Message, Oneof};

Expand Down
8 changes: 6 additions & 2 deletions tests/src/skip_debug.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
//! Tests for skipping the default Debug implementation.

use std::fmt;

use prost::alloc::format;
#[cfg(not(feature = "std"))]
use prost::alloc::string::String;

use crate::custom_debug::{msg, AnEnum, Msg};
use crate::message_encoding::BasicEnumeration;
use prost::alloc::{format, string::String};
use std::fmt;

/// A special case with a tuple struct
#[test]
Expand Down

0 comments on commit 7157f96

Please sign in to comment.