Skip to content
Myr

Work around prelude redundant import warnings

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/rust-lang/rust/pull/117772 warning: the item `String` is imported redundantly --> src/ensure.rs:2:5 | 2 | use alloc::string::String; | ^^^^^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:115:13 | 115 | pub use super::v1::*; | --------- the item `String` is already defined here | = note: `#[warn(unused_imports)]` on by default warning: the item `Box` is imported redundantly --> src/error.rs:7:5 | 7 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:115:13 | 115 | pub use super::v1::*; | --------- the item `Box` is already defined here warning: the item `Box` is imported redundantly --> src/ptr.rs:1:5 | 1 | use alloc::boxed::Box; | ^^^^^^^^^^^^^^^^^ | ::: nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude/mod.rs:115:13 | 115 | pub use super::v1::*; | --------- the item `Box` is already defined here

authored by David Tolnay · committed by David Tolnay · parent 6e4f86b · Browse files · 6 files+12 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+12 added−3 removed

  • tests:+0 added−1 removed
  • other:+12 added−2 removed

6 files+12 added−3 removed

modified:src/chain.rs+1 added-1 removed
1use self::ChainState::*;2use crate::StdError;34#[cfg(feature = "std")]5use alloc::vec;5use alloc::vec::{self, Vec};67#[cfg(feature = "std")]8pub(crate) use crate::Chain;9
93 unmodified lines
modified:src/fmt.rs+2 added
41 unmodified lines
4243 #[cfg(any(std_backtrace, feature = "backtrace"))]44 {45 use crate::backtrace::BacktraceStatus;46 use alloc::string::ToString;4748 let backtrace = unsafe { Self::backtrace(this) };49 if let BacktraceStatus::Captured = backtrace.status() {50 let mut backtrace = backtrace.to_string();
51 unmodified lines
102103#[cfg(test)]104mod tests {105 use super::*;106 use alloc::string::String;107108 #[test]109 fn one_digit() {110 let input = "verify\nthis";
48 unmodified lines
modified:src/kind.rs+2 added
47 unmodified lines
48use core::fmt::{Debug, Display};4950#[cfg(feature = "std")]51use crate::StdError;52#[cfg(feature = "std")]53use alloc::boxed::Box;5455pub struct Adhoc;5657#[doc(hidden)]
64 unmodified lines
modified:src/lib.rs+4 added-1 removed
207 unmodified lines
208209#![doc(html_root_url = "https://docs.rs/anyhow/1.0.79")]210#![cfg_attr(error_generic_member_access, feature(error_generic_member_access))]211#![cfg_attr(doc_cfg, feature(doc_cfg))]212#![cfg_attr(not(feature = "std"), no_std)]212#![no_std]213#![deny(dead_code, unused_imports, unused_mut)]214#![cfg_attr(215 not(anyhow_no_unsafe_op_in_unsafe_fn_lint),216 deny(unsafe_op_in_unsafe_fn)
29 unmodified lines
246compile_error!("Build script probe failed to compile.");247248extern crate alloc;249250#[cfg(feature = "std")]251extern crate std;252253#[macro_use]254mod backtrace;255mod chain;256mod context;
446 unmodified lines
modified:src/wrapper.rs+3 added
1use crate::StdError;2use core::fmt::{self, Debug, Display};34#[cfg(feature = "std")]5use alloc::boxed::Box;67#[cfg(error_generic_member_access)]8use std::error::Request;910#[repr(transparent)]
74 unmodified lines
modified:tests/test_repr.rs-1 removed
2 unmodified lines
3mod drop;45use self::drop::{DetectDrop, Flag};6use anyhow::Error;7use std::marker::Unpin;7use std::mem;89#[test]10fn test_error_size() {
20 unmodified lines