From 1caf10d7a3c70efcbb3a500035352b681c449f79 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Mon, 8 May 2023 15:33:12 +0200 Subject: [PATCH] Ignore snapshot outputs on non-nightly compiler --- libs/error-stack/src/fmt.rs | 8 ++++---- libs/error-stack/src/fmt/charset.rs | 8 ++++---- libs/error-stack/src/fmt/color.rs | 10 +++++----- libs/error-stack/src/fmt/hook.rs | 26 +++++++++++++------------- libs/error-stack/src/hook.rs | 6 +++--- libs/error-stack/src/hook/context.rs | 18 +++++++++--------- libs/error-stack/src/lib.rs | 6 +++--- libs/error-stack/src/report.rs | 8 ++++---- 8 files changed, 45 insertions(+), 45 deletions(-) diff --git a/libs/error-stack/src/fmt.rs b/libs/error-stack/src/fmt.rs index 5406c1112cd..ae6922ceaf0 100644 --- a/libs/error-stack/src/fmt.rs +++ b/libs/error-stack/src/fmt.rs @@ -40,8 +40,8 @@ //! ## Example //! //! ```rust -//! # // we only test with Rust 1.65, which means that `render()` is unused on earlier version -//! # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] +//! # // we only test with nightly, which means that `render()` is unused on earlier version +//! # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] //! use std::fmt::{Display, Formatter}; //! use std::io::{Error, ErrorKind}; //! use error_stack::Report; @@ -110,12 +110,12 @@ //! # ansi_to_html::convert_escaped(value.as_ref()).unwrap() //! # } //! # -//! # #[cfg(rust_1_65)] +//! # #[cfg(nightly)] //! # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__doc.snap")].assert_eq(&render(format!("{report:?}"))); //! # //! println!("{report:?}"); //! -//! # #[cfg(rust_1_65)] +//! # #[cfg(nightly)] //! # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt_doc_alt.snap")].assert_eq(&render(format!("{report:#?}"))); //! # //! println!("{report:#?}"); diff --git a/libs/error-stack/src/fmt/charset.rs b/libs/error-stack/src/fmt/charset.rs index 572192f874a..83987a73000 100644 --- a/libs/error-stack/src/fmt/charset.rs +++ b/libs/error-stack/src/fmt/charset.rs @@ -59,8 +59,8 @@ impl Report<()> { /// # Example /// /// ``` - /// # // we only test the snapshot on rust 1.65, therefore report is unused (so is render) - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test the snapshot on nightly, therefore report is unused (so is render) + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::{Error, ErrorKind}; /// /// use error_stack::{report, Report}; @@ -90,12 +90,12 @@ impl Report<()> { /// # /// Report::set_charset(Charset::Utf8); /// println!("{report:?}"); - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__charset_utf8.snap")].assert_eq(&render(format!("{report:?}"))); /// /// Report::set_charset(Charset::Ascii); /// println!("{report:?}"); - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__charset_ascii.snap")].assert_eq(&render(format!("{report:?}"))); /// ``` /// diff --git a/libs/error-stack/src/fmt/color.rs b/libs/error-stack/src/fmt/color.rs index 5318bba3038..79d701493fa 100644 --- a/libs/error-stack/src/fmt/color.rs +++ b/libs/error-stack/src/fmt/color.rs @@ -68,8 +68,8 @@ impl Report<()> { /// # Example /// /// ``` - /// # // we only test the snapshot on rust 1.65, therefore report is unused (so is render) - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test the snapshot on nightly, therefore report is unused (so is render) + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::{Error, ErrorKind}; /// use owo_colors::OwoColorize; /// @@ -102,17 +102,17 @@ impl Report<()> { /// # /// Report::set_color_mode(ColorMode::None); /// println!("{report:?}"); - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__preference_none.snap")].assert_eq(&render(format!("{report:?}"))); /// /// Report::set_color_mode(ColorMode::Emphasis); /// println!("{report:?}"); - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__preference_emphasis.snap")].assert_eq(&render(format!("{report:?}"))); /// /// Report::set_color_mode(ColorMode::Color); /// println!("{report:?}"); - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__preference_color.snap")].assert_eq(&render(format!("{report:?}"))); /// ``` /// diff --git a/libs/error-stack/src/fmt/hook.rs b/libs/error-stack/src/fmt/hook.rs index 11d7d925cfd..49d36b373f1 100644 --- a/libs/error-stack/src/fmt/hook.rs +++ b/libs/error-stack/src/fmt/hook.rs @@ -64,8 +64,8 @@ crate::hook::context::impl_hook_context! { /// ### Example /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::{Error, ErrorKind}; /// /// use error_stack::Report; @@ -130,12 +130,12 @@ crate::hook::context::impl_hook_context! { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__emit.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); /// - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__emit_alt.snap")].assert_eq(&render(format!("{report:#?}"))); /// # /// println!("{report:#?}"); @@ -168,8 +168,8 @@ crate::hook::context::impl_hook_context! { /// ### Example /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::ErrorKind; /// /// use error_stack::Report; @@ -210,7 +210,7 @@ crate::hook::context::impl_hook_context! { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__hookcontext_storage.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); @@ -255,8 +255,8 @@ impl HookContext { /// # Example /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::ErrorKind; /// /// use error_stack::Report; @@ -296,7 +296,7 @@ impl HookContext { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__hookcontext_emit.snap")].assert_eq(&render(format!("{report:#?}"))); /// # /// println!("{report:#?}"); @@ -314,8 +314,8 @@ impl HookContext { /// # Example /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io; /// /// use error_stack::Report; @@ -343,7 +343,7 @@ impl HookContext { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__diagnostics_add.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); diff --git a/libs/error-stack/src/hook.rs b/libs/error-stack/src/hook.rs index fb1fa57edf1..ec8e433b3bf 100644 --- a/libs/error-stack/src/hook.rs +++ b/libs/error-stack/src/hook.rs @@ -28,8 +28,8 @@ impl Report<()> { /// # Examples /// /// ``` - /// # // we only test the snapshot on rust 1.65, therefore report is unused (so is render) - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test the snapshot on nightly, therefore report is unused (so is render) + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::{Error, ErrorKind}; /// /// use error_stack::{ @@ -56,7 +56,7 @@ impl Report<()> { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/hook__debug_hook.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); diff --git a/libs/error-stack/src/hook/context.rs b/libs/error-stack/src/hook/context.rs index f85b350e3f0..96acb969c78 100644 --- a/libs/error-stack/src/hook/context.rs +++ b/libs/error-stack/src/hook/context.rs @@ -114,8 +114,8 @@ impl HookContext { /// ### Example /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::ErrorKind; /// /// use error_stack::Report; @@ -153,7 +153,7 @@ impl HookContext { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__hookcontext_cast.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); @@ -235,8 +235,8 @@ impl HookContext { /// increment a counter, if the counter wasn't initialized this method will return `0`. /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::ErrorKind; /// /// use error_stack::Report; @@ -263,7 +263,7 @@ impl HookContext { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__hookcontext_increment.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); @@ -302,8 +302,8 @@ impl HookContext { /// consistent with [`HookContext::increment_counter`]. /// /// ```rust - /// # // we only test with Rust 1.65, which means that `render()` is unused on earlier version - /// # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] + /// # // we only test with nightly, which means that `render()` is unused on earlier version + /// # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] /// use std::io::ErrorKind; /// /// use error_stack::Report; @@ -330,7 +330,7 @@ impl HookContext { /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } /// # - /// # #[cfg(rust_1_65)] + /// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/fmt__hookcontext_decrement.snap")].assert_eq(&render(format!("{report:?}"))); /// # /// println!("{report:?}"); diff --git a/libs/error-stack/src/lib.rs b/libs/error-stack/src/lib.rs index 420edd24c1b..afb5373f9f7 100644 --- a/libs/error-stack/src/lib.rs +++ b/libs/error-stack/src/lib.rs @@ -151,8 +151,8 @@ //! [`Report::attach()`] and [`Report::attach_printable()`]: //! //! ```rust -//! # // we only test the snapshot on rust 1.65, therefore report is unused (so is render) -//! # #![cfg_attr(not(rust_1_65), allow(dead_code, unused_variables, unused_imports))] +//! # // we only test the snapshot on nightly, therefore report is unused (so is render) +//! # #![cfg_attr(not(nightly), allow(dead_code, unused_variables, unused_imports))] //! # use std::{fs, path::Path}; //! # use error_stack::{Context, IntoReport, Report, ResultExt}; //! # pub type Config = String; @@ -198,7 +198,7 @@ //! # ansi_to_html::convert_escaped(value.as_ref()).unwrap() //! # } //! # -//! # #[cfg(rust_1_65)] +//! # #[cfg(nightly)] //! # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/lib__suggestion.snap")].assert_eq(&render(format!("{report:?}"))); //! ``` //! diff --git a/libs/error-stack/src/report.rs b/libs/error-stack/src/report.rs index c9e2930c7c7..ce566d9b905 100644 --- a/libs/error-stack/src/report.rs +++ b/libs/error-stack/src/report.rs @@ -169,7 +169,7 @@ use crate::{ /// # assert!(report.contains::()); /// # assert_eq!(report.downcast_ref::(), Some(&RuntimeError::InvalidConfig(PathBuf::from("./path/to/config.file")))); /// # Report::set_color_mode(error_stack::fmt::ColorMode::Emphasis); -/// # #[cfg(rust_1_65)] +/// # #[cfg(nightly)] /// # fn render(value: String) -> String { /// # let backtrace = regex::Regex::new(r"backtrace no\. (\d+)\n(?: .*\n)* .*").unwrap(); /// # let backtrace_info = regex::Regex::new(r"backtrace( with (\d+) frames)? \((\d+)\)").unwrap(); @@ -179,11 +179,11 @@ use crate::{ /// # /// # ansi_to_html::convert_escaped(value.as_ref()).unwrap() /// # } -/// # #[cfg(rust_1_65)] +/// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display__doc.snap")].assert_eq(&render(format!("{report}"))); -/// # #[cfg(rust_1_65)] +/// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_display_alt__doc.snap")].assert_eq(&render(format!("{report:#}"))); -/// # #[cfg(rust_1_65)] +/// # #[cfg(nightly)] /// # expect_test::expect_file![concat!(env!("CARGO_MANIFEST_DIR"), "/tests/snapshots/doc/report_debug__doc.snap")].assert_eq(&render(format!("{report:?}"))); /// # Ok(()) /// }