mirror of https://github.com/zkat/miette.git
fix(clippy): fix `clippy::doc_lazy_continuation` lints (#395)
* Fix `clippy::doc_lazy_continuation` lints * Fix `dead_code` warnings in tests. Protect code used in some tests based on features with feature checks. * Fix `clippy::needless_borrows_for_generic_args` lints * Remove a useless conversion * Remove a cfg_attr check for `track_caller` This shouldn't be needed here as the test is already ignored.
This commit is contained in:
parent
bf5aa3742f
commit
15beec4330
16
README.md
16
README.md
|
|
@ -28,9 +28,9 @@ diagnostic error code: ruget::api::bad_json
|
|||
" />
|
||||
|
||||
> **NOTE: You must enable the `"fancy"` crate feature to get fancy report
|
||||
output like in the screenshots above.** You should only do this in your
|
||||
toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
libraries and such might not want.
|
||||
> output like in the screenshots above.** You should only do this in your
|
||||
> toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
> libraries and such might not want.
|
||||
|
||||
### Table of Contents <!-- omit in toc -->
|
||||
|
||||
|
|
@ -288,9 +288,9 @@ There are also similar [bail!] and [ensure!] macros.
|
|||
automatically.
|
||||
|
||||
> **NOTE:** You must enable the `"fancy"` crate feature to get fancy report
|
||||
output like in the screenshots here.** You should only do this in your
|
||||
toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
libraries and such might not want.
|
||||
> output like in the screenshots here.** You should only do this in your
|
||||
> toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
> libraries and such might not want.
|
||||
|
||||
```rust
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
|
|
@ -645,8 +645,8 @@ customize!
|
|||
If you...
|
||||
- ...don't know all the possible errors upfront
|
||||
- ...need to serialize/deserialize errors
|
||||
then you may want to use [`miette!`], [`diagnostic!`] macros or
|
||||
[`MietteDiagnostic`] directly to create diagnostic on the fly.
|
||||
then you may want to use [`miette!`], [`diagnostic!`] macros or
|
||||
[`MietteDiagnostic`] directly to create diagnostic on the fly.
|
||||
|
||||
```rust
|
||||
|
||||
|
|
|
|||
16
src/lib.rs
16
src/lib.rs
|
|
@ -28,9 +28,9 @@
|
|||
//! " />
|
||||
//!
|
||||
//! > **NOTE: You must enable the `"fancy"` crate feature to get fancy report
|
||||
//! output like in the screenshots above.** You should only do this in your
|
||||
//! toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
//! libraries and such might not want.
|
||||
//! > output like in the screenshots above.** You should only do this in your
|
||||
//! > toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
//! > libraries and such might not want.
|
||||
//!
|
||||
//! ## Table of Contents <!-- omit in toc -->
|
||||
//!
|
||||
|
|
@ -288,9 +288,9 @@
|
|||
//! automatically.
|
||||
//!
|
||||
//! > **NOTE:** You must enable the `"fancy"` crate feature to get fancy report
|
||||
//! output like in the screenshots here.** You should only do this in your
|
||||
//! toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
//! libraries and such might not want.
|
||||
//! > output like in the screenshots here.** You should only do this in your
|
||||
//! > toplevel crate, as the fancy feature pulls in a number of dependencies that
|
||||
//! > libraries and such might not want.
|
||||
//!
|
||||
//! ```rust
|
||||
//! use miette::{IntoDiagnostic, Result};
|
||||
|
|
@ -645,8 +645,8 @@
|
|||
//! If you...
|
||||
//! - ...don't know all the possible errors upfront
|
||||
//! - ...need to serialize/deserialize errors
|
||||
//! then you may want to use [`miette!`], [`diagnostic!`] macros or
|
||||
//! [`MietteDiagnostic`] directly to create diagnostic on the fly.
|
||||
//! then you may want to use [`miette!`], [`diagnostic!`] macros or
|
||||
//! [`MietteDiagnostic`] directly to create diagnostic on the fly.
|
||||
//!
|
||||
//! ```rust,ignore
|
||||
//! # use miette::{miette, LabeledSpan, Report};
|
||||
|
|
|
|||
|
|
@ -2000,11 +2000,11 @@ fn syntax_highlighter_on_real_file() {
|
|||
// SourceSpan constants for column and length
|
||||
const CO: usize = 28;
|
||||
const LEN: usize = 27;
|
||||
let file_src = std::fs::read_to_string(&filename).unwrap();
|
||||
let file_src = std::fs::read_to_string(filename).unwrap();
|
||||
let offset = miette::SourceOffset::from_location(&file_src, line, CO);
|
||||
let err = Test {
|
||||
src: NamedSource::new(&filename, file_src.clone()),
|
||||
src_span: SourceSpan::new(offset, LEN.into()),
|
||||
src: NamedSource::new(filename, file_src.clone()),
|
||||
src_span: SourceSpan::new(offset, LEN),
|
||||
};
|
||||
|
||||
let mut out = String::new();
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ fn test_diagnostic_source_is_output() {
|
|||
assert_eq!(expected, out);
|
||||
}
|
||||
|
||||
#[cfg(feature = "fancy-no-backtrace")]
|
||||
#[derive(Debug, miette::Diagnostic, thiserror::Error)]
|
||||
#[error("A nested error happened")]
|
||||
struct NestedError {
|
||||
|
|
@ -212,6 +213,7 @@ fn test_nested_diagnostic_source_is_output() {
|
|||
assert_eq!(expected, out);
|
||||
}
|
||||
|
||||
#[cfg(feature = "fancy-no-backtrace")]
|
||||
#[derive(Debug, miette::Diagnostic, thiserror::Error)]
|
||||
#[error("A multi-error happened")]
|
||||
struct MultiError {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ fn test_altdisplay() {
|
|||
|
||||
#[test]
|
||||
#[ignore = "not really gonna work with the current printers"]
|
||||
#[cfg_attr(track_caller, ignore)]
|
||||
fn test_debug() {
|
||||
assert_eq!(EXPECTED_DEBUG_F, format!("{:?}", f().unwrap_err()));
|
||||
assert_eq!(EXPECTED_DEBUG_G, format!("{:?}", g().unwrap_err()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue