Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit c31ffd3

Browse files
authored
Merge pull request #265 from AndyGauge/bare_trait_objects
bare_trait_objects for deprecations
2 parents 63653c8 + f51f4ab commit c31ffd3

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/error_chain.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ macro_rules! impl_error_chain_cause_or_source {
4747
$( #[$meta_foreign_links:meta] )*; )*
4848
}
4949
) => {
50-
#[allow(unknown_lints, renamed_and_removed_lints)]
50+
#[allow(unknown_lints, renamed_and_removed_lints, bare_trait_objects)]
5151
#[allow(unused_doc_comment, unused_doc_comments)]
5252
fn source(&self) -> Option<&(std::error::Error + 'static)> {
5353
match self.1.next_error {
@@ -261,6 +261,7 @@ macro_rules! impl_error_chain_processed {
261261
}
262262

263263
/// Construct a chained error from another boxed error and a kind, and generates a backtrace
264+
#[allow(unknown_lints, bare_trait_objects)]
264265
pub fn with_boxed_chain<K>(error: Box<::std::error::Error + Send>, kind: K)
265266
-> $error_name
266267
where K: Into<$error_kind_name>
@@ -522,7 +523,7 @@ macro_rules! impl_extract_backtrace {
522523
($error_name: ident
523524
$error_kind_name: ident
524525
$([$link_error_path: path, $(#[$meta_links: meta])*])*) => {
525-
#[allow(unknown_lints, renamed_and_removed_lints)]
526+
#[allow(unknown_lints, renamed_and_removed_lints, bare_trait_objects)]
526527
#[allow(unused_doc_comment, unused_doc_comments)]
527528
fn extract_backtrace(e: &(::std::error::Error + Send + 'static))
528529
-> Option<$crate::InternalBacktrace> {

src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -558,16 +558,19 @@ pub use backtrace::Backtrace;
558558
pub use backtrace::InternalBacktrace;
559559

560560
#[derive(Debug)]
561+
#[allow(unknown_lints, bare_trait_objects)]
561562
/// Iterator over the error chain using the `Error::cause()` method.
562563
pub struct Iter<'a>(Option<&'a error::Error>);
563564

564565
impl<'a> Iter<'a> {
565566
/// Returns a new iterator over the error chain using `Error::cause()`.
567+
#[allow(unknown_lints, bare_trait_objects)]
566568
pub fn new(err: Option<&'a error::Error>) -> Iter<'a> {
567569
Iter(err)
568570
}
569571
}
570572

573+
#[allow(unknown_lints, bare_trait_objects)]
571574
impl<'a> Iterator for Iter<'a> {
572575
type Item = &'a error::Error;
573576

@@ -631,6 +634,7 @@ pub trait ChainedError: error::Error + Send + 'static {
631634
/// Returns the first known backtrace, either from its State or from one
632635
/// of the errors from `foreign_links`.
633636
#[doc(hidden)]
637+
#[allow(unknown_lints, bare_trait_objects)]
634638
fn extract_backtrace(e: &(error::Error + Send + 'static)) -> Option<InternalBacktrace>
635639
where Self: Sized;
636640
}
@@ -661,6 +665,7 @@ impl<'a, T> fmt::Display for DisplayChain<'a, T>
661665
/// Common state between errors.
662666
#[derive(Debug)]
663667
#[doc(hidden)]
668+
#[allow(unknown_lints, bare_trait_objects)]
664669
pub struct State {
665670
/// Next error in the error chain.
666671
pub next_error: Option<Box<error::Error + Send>>,
@@ -679,6 +684,7 @@ impl Default for State {
679684

680685
impl State {
681686
/// Creates a new State type
687+
#[allow(unknown_lints, bare_trait_objects)]
682688
pub fn new<CE: ChainedError>(e: Box<error::Error + Send>) -> State {
683689
let backtrace = CE::extract_backtrace(&*e)
684690
.unwrap_or_else(InternalBacktrace::new);

tests/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ mod foreign_link_test {
370370
}
371371

372372
#[test]
373+
#[allow(unknown_lints, bare_trait_objects)]
373374
fn iterates() {
374375
let chained_error = try_foreign_error().err().unwrap();
375376
let mut error_iter = chained_error.iter();

0 commit comments

Comments
 (0)