From 10c3b7f809ec7f8885c4f63fc9e36d3e419c339e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sat, 15 Jul 2023 18:48:00 -0700 Subject: [PATCH] docs: update readme again --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a60ef11..7aabe99 100644 --- a/README.md +++ b/README.md @@ -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`! */ -use miette::{Diagnostic, NamedSource, Result, SourceSpan}; +use miette::{Diagnostic, SourceSpan}; use thiserror::Error; #[derive(Error, Debug, Diagnostic)] @@ -123,10 +123,12 @@ Use this `Result` type (or its expanded version) as the return type throughout your app (but NOT your libraries! Those should always return concrete types!). */ +use miette::{NamedSource, Result}; fn this_fails() -> Result<()> { // You can use plain strings as a `Source`, or anything that implements // the one-method `Source` trait. let src = "source\n text\n here".to_string(); + let len = src.len(); Err(MyBad { src: NamedSource::new("bad_file.rs", src),