Skip to content

Commit ae0d825

Browse files
committed
Use crate::prelude::* rather than specific imports
New rustc beta now warns on duplicate imports when one of the imports is from a wildcard import or the default prelude. Thus, to avoid this here we prefer to always use `crate::prelude::*` and let it decide if we actually need to import anything.
1 parent 061d396 commit ae0d825

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+47
-78
lines changed

lightning-invoice/src/de.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[cfg(feature = "std")]
22
use std::error;
3+
#[cfg(not(feature = "std"))]
34
use core::convert::TryFrom;
45
use core::fmt;
56
use core::fmt::{Display, Formatter};

lightning-invoice/src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use secp256k1::PublicKey;
1919
use alloc::collections::{btree_map, BTreeMap};
2020
use core::ops::Deref;
2121
use core::time::Duration;
22+
#[cfg(not(feature = "std"))]
2223
use core::iter::Iterator;
2324

2425
/// Utility to create an invoice that can be paid to one of multiple nodes, or a "phantom invoice."

lightning/src/blinded_path/payment.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use crate::util::ser::{HighZeroBytesDroppedBigSize, Readable, Writeable, Writer}
1717
#[allow(unused_imports)]
1818
use crate::prelude::*;
1919

20-
use core::convert::TryFrom;
21-
2220
/// An intermediate node, its outbound channel, and relay parameters.
2321
#[derive(Clone, Debug)]
2422
pub struct ForwardNode {

lightning/src/chain/chaininterface.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
//! disconnections, transaction broadcasting, and feerate information requests.
1515
1616
use core::{cmp, ops::Deref};
17-
use core::convert::TryInto;
17+
18+
use crate::prelude::*;
1819

1920
use bitcoin::blockdata::transaction::Transaction;
2021

lightning/src/chain/channelmonitor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ use crate::prelude::*;
5858

5959
use core::{cmp, mem};
6060
use crate::io::{self, Error};
61-
use core::convert::TryInto;
6261
use core::ops::Deref;
6362
use crate::sync::{Mutex, LockTestExt};
6463

lightning/src/chain/package.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use crate::util::ser::{Readable, Writer, Writeable, RequiredWrapper};
3636

3737
use crate::io;
3838
use core::cmp;
39-
use core::convert::TryInto;
4039
use core::mem;
4140
use core::ops::Deref;
4241

lightning/src/crypto/chacha20.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#[cfg(not(fuzzing))]
1313
mod real_chacha {
1414
use core::cmp;
15-
use core::convert::TryInto;
1615

1716
#[derive(Clone, Copy, PartialEq, Eq)]
1817
#[allow(non_camel_case_types)]
@@ -335,11 +334,10 @@ pub use self::fuzzy_chacha::ChaCha20;
335334

336335
#[cfg(test)]
337336
mod test {
338-
use alloc::vec;
339-
use alloc::vec::{Vec};
340-
use core::convert::TryInto;
341337
use core::iter::repeat;
342338

339+
use crate::prelude::*;
340+
343341
use super::ChaCha20;
344342

345343
#[test]

lightning/src/crypto/poly1305.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// https://github.com/floodyberry/poly1305-donna
99

1010
use core::cmp::min;
11-
use core::convert::TryInto;
11+
12+
use crate::prelude::*;
1213

1314
#[derive(Clone, Copy)]
1415
pub struct Poly1305 {
@@ -206,7 +207,6 @@ impl Poly1305 {
206207
#[cfg(test)]
207208
mod test {
208209
use core::iter::repeat;
209-
use alloc::vec::Vec;
210210

211211
use super::Poly1305;
212212

lightning/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,15 @@ mod io_extras {
165165
}
166166

167167
mod prelude {
168+
#![allow(unused_imports)]
169+
168170
pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};
169171

170172
pub use alloc::borrow::ToOwned;
171173
pub use alloc::string::ToString;
172174

173-
pub use core::convert::{TryFrom, TryInto};
175+
pub use core::convert::{AsMut, AsRef, TryFrom, TryInto};
176+
pub use core::default::Default;
174177
pub use core::marker::Sized;
175178

176179
pub(crate) use crate::util::hash_tables::*;

lightning/src/ln/channel.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use crate::util::scid_utils::scid_from_parts;
5050
use crate::io;
5151
use crate::prelude::*;
5252
use core::{cmp,mem,fmt};
53-
use core::convert::TryInto;
5453
use core::ops::Deref;
5554
#[cfg(any(test, fuzzing, debug_assertions))]
5655
use crate::sync::Mutex;

0 commit comments

Comments
 (0)