Skip to content

Commit

Permalink
bump to miette-7 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Dec 9, 2024
1 parent 3fc2181 commit 9b049ed
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 67 deletions.
109 changes: 53 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ exec = "0.3"
heck = "0.5"
indexmap = "2"
itertools = "0.13"
kdl = "<4.7"
kdl = "4"
log = "0.4"
miette = { version = "5", features = ["fancy"] }
miette = { version = "7", features = ["fancy"] }
once_cell = "1"
regex = "1"
serde = { version = "1", features = ["derive"] }
Expand All @@ -44,7 +44,7 @@ strum = { version = "0.26", features = ["derive"] }
tera = "1"
thiserror = "2"
usage-lib = { workspace = true, features = ["clap", "docs"] }
xx = "1"
xx = "2"

[dev-dependencies]
assert_cmd = { version = "2", features = ["color-auto"] }
Expand Down
6 changes: 3 additions & 3 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ clap = { version = "4", features = ["derive", "string"], optional = true }
heck = "0.5"
indexmap = { version = "2", features = ["serde"] }
itertools = "0.13"
kdl = "<4.7"
kdl = "4"
log = "0.4"
miette = "5"
miette = "7"
once_cell = "1"
regex = "1"
serde = { version = "1", features = ["derive"] }
strum = { version = "0.26", features = ["derive"] }
tera = { version = "1", optional = true }
thiserror = "2"
versions = "6"
xx = "1"
xx = "2"

[features]
default = ["docs"]
Expand Down
8 changes: 5 additions & 3 deletions lib/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum UsageErr {
InvalidInput(
String,
#[label = "{0}"] SourceSpan,
#[source_code] NamedSource,
#[source_code] NamedSource<String>,
),

#[error("Missing required arg: <{0}>")]
Expand Down Expand Up @@ -52,13 +52,15 @@ pub type Result<T> = std::result::Result<T, UsageErr>;
#[macro_export]
macro_rules! bail_parse {
($ctx:expr, $span:expr, $fmt:literal) => {{
let span: miette::SourceSpan = ($span.offset(), $span.len()).into();
let msg = format!($fmt);
let err = $ctx.build_err(msg, $span);
let err = $ctx.build_err(msg, span);
return std::result::Result::Err(err);
}};
($ctx:expr, $span:expr, $fmt:literal, $($arg:tt)*) => {{
let span: miette::SourceSpan = ($span.offset(), $span.len()).into();
let msg = format!($fmt, $($arg)*);
let err = $ctx.build_err(msg, $span);
let err = $ctx.build_err(msg, span);
return std::result::Result::Err(err);
}};
}
4 changes: 2 additions & 2 deletions lib/src/spec/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> NodeHelper<'a> {
self.node.name().value()
}
pub(crate) fn span(&self) -> SourceSpan {
*self.node.span()
(self.node.span().offset(), self.node.span().len()).into()
}
pub(crate) fn ensure_arg_len<R>(&self, range: R) -> Result<&Self, UsageErr>
where
Expand Down Expand Up @@ -92,7 +92,7 @@ impl<'a> ParseEntry<'a> {
}

fn span(&self) -> SourceSpan {
*self.entry.span()
(self.entry.span().offset(), self.entry.span().len()).into()
}
}

Expand Down
1 change: 1 addition & 0 deletions mise.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "1.7.4"
version = "1.10.8"

[tools.cargo-binstall.checksums]
"cargo-binstall-aarch64-apple-darwin.zip" = "sha256:23a27d534c98fed95e88c320fd7de154f851af7bce9100eed15e72fee316804c"
cargo-binstall-macos-aarch64 = "sha256:c30a499060745f0c4435a446253fc676838cff0a18d2dd555fcf10399176b1bf"

[tools."cargo:cargo-edit"]
Expand Down

0 comments on commit 9b049ed

Please sign in to comment.