Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore doc-snapshot outputs on non-nightly compiler #2528

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libs/error-stack/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:#?}");
Expand Down
8 changes: 4 additions & 4 deletions libs/error-stack/src/fmt/charset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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:?}")));
/// ```
///
Expand Down
10 changes: 5 additions & 5 deletions libs/error-stack/src/fmt/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
///
Expand Down Expand Up @@ -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:?}")));
/// ```
///
Expand Down
26 changes: 13 additions & 13 deletions libs/error-stack/src/fmt/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:#?}");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:?}");
Expand Down Expand Up @@ -255,8 +255,8 @@ impl<T> HookContext<T> {
/// # 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;
Expand Down Expand Up @@ -296,7 +296,7 @@ impl<T> HookContext<T> {
/// # 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:#?}");
Expand All @@ -314,8 +314,8 @@ impl<T> HookContext<T> {
/// # 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;
Expand Down Expand Up @@ -343,7 +343,7 @@ impl<T> HookContext<T> {
/// # 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:?}");
Expand Down
6 changes: 3 additions & 3 deletions libs/error-stack/src/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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:?}");
Expand Down
18 changes: 9 additions & 9 deletions libs/error-stack/src/hook/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ impl<T> HookContext<T> {
/// ### 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;
Expand Down Expand Up @@ -153,7 +153,7 @@ impl<T> HookContext<T> {
/// # 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:?}");
Expand Down Expand Up @@ -235,8 +235,8 @@ impl<T: 'static> HookContext<T> {
/// 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;
Expand All @@ -263,7 +263,7 @@ impl<T: 'static> HookContext<T> {
/// # 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:?}");
Expand Down Expand Up @@ -302,8 +302,8 @@ impl<T: 'static> HookContext<T> {
/// 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;
Expand All @@ -330,7 +330,7 @@ impl<T: 'static> HookContext<T> {
/// # 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:?}");
Expand Down
6 changes: 3 additions & 3 deletions libs/error-stack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:?}")));
//! ```
//!
Expand Down
8 changes: 4 additions & 4 deletions libs/error-stack/src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ use crate::{
/// # assert!(report.contains::<ConfigError>());
/// # assert_eq!(report.downcast_ref::<RuntimeError>(), 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();
Expand All @@ -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(())
/// }
Expand Down