docs: a little cleaning in README (#274)

This commit is contained in:
0x009922 2023-06-29 08:42:12 +07:00 committed by GitHub
parent 01b60a7df8
commit 89806755a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -96,7 +96,7 @@ You can derive a `Diagnostic` from any `std::error::Error` type.
`thiserror` is a great way to define them, and plays nicely with `miette`! `thiserror` is a great way to define them, and plays nicely with `miette`!
*/ */
use miette::{Diagnostic, SourceSpan}; use miette::{Diagnostic, NamedSource, Result, SourceSpan};
use thiserror::Error; use thiserror::Error;
#[derive(Error, Debug, Diagnostic)] #[derive(Error, Debug, Diagnostic)]
@ -123,12 +123,10 @@ Use this `Result` type (or its expanded version) as the return type
throughout your app (but NOT your libraries! Those should always return throughout your app (but NOT your libraries! Those should always return
concrete types!). concrete types!).
*/ */
use miette::{NamedSource, Result};
fn this_fails() -> Result<()> { fn this_fails() -> Result<()> {
// You can use plain strings as a `Source`, or anything that implements // You can use plain strings as a `Source`, or anything that implements
// the one-method `Source` trait. // the one-method `Source` trait.
let src = "source\n text\n here".to_string(); let src = "source\n text\n here".to_string();
let len = src.len();
Err(MyBad { Err(MyBad {
src: NamedSource::new("bad_file.rs", src), src: NamedSource::new("bad_file.rs", src),