From b866e58926bf45693f19589f37f17802254dc884 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:57:39 -0300 Subject: [PATCH] add deprecated id for deprecations cf https://github.com/typst/typst/pull/4562 --- crates/typst/src/foundations/styles.rs | 4 +++- crates/typst/src/introspection/counter.rs | 8 ++++++-- crates/typst/src/introspection/locate.rs | 4 +++- crates/typst/src/introspection/query.rs | 4 +++- crates/typst/src/introspection/state.rs | 8 ++++++-- crates/typst/src/layout/measure.rs | 4 +++- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/crates/typst/src/foundations/styles.rs b/crates/typst/src/foundations/styles.rs index 48009c8c3..db870d62b 100644 --- a/crates/typst/src/foundations/styles.rs +++ b/crates/typst/src/foundations/styles.rs @@ -46,7 +46,9 @@ pub fn style( func: Func, ) -> Content { engine.sink.warn(warning!( - span, "`style` is deprecated"; + span, + id: "deprecated", + message: "`style` is deprecated"; hint: "use a `context` expression instead" )); diff --git a/crates/typst/src/introspection/counter.rs b/crates/typst/src/introspection/counter.rs index 2aefb68ec..9829d42e9 100644 --- a/crates/typst/src/introspection/counter.rs +++ b/crates/typst/src/introspection/counter.rs @@ -465,7 +465,9 @@ impl Counter { self.display_impl(engine, loc, numbering, both, context.styles().ok()) } else { engine.sink.warn(warning!( - span, "`counter.display` without context is deprecated"; + span, + id: "deprecated", + message: "`counter.display` without context is deprecated"; hint: "use it in a `context` expression instead" )); @@ -523,7 +525,9 @@ impl Counter { context.location().at(span)?; } else { engine.sink.warn(warning!( - span, "calling `counter.final` with a location is deprecated"; + span, + id: "deprecated", + message: "calling `counter.final` with a location is deprecated"; hint: "try removing the location argument" )); } diff --git a/crates/typst/src/introspection/locate.rs b/crates/typst/src/introspection/locate.rs index 8991ae9be..15e51ce1f 100644 --- a/crates/typst/src/introspection/locate.rs +++ b/crates/typst/src/introspection/locate.rs @@ -58,7 +58,9 @@ pub fn locate( } LocateInput::Func(func) => { engine.sink.warn(warning!( - span, "`locate` with callback function is deprecated"; + span, + id: "deprecated", + message: "`locate` with callback function is deprecated"; hint: "use a `context` expression instead" )); diff --git a/crates/typst/src/introspection/query.rs b/crates/typst/src/introspection/query.rs index 07f761a8d..799919905 100644 --- a/crates/typst/src/introspection/query.rs +++ b/crates/typst/src/introspection/query.rs @@ -161,7 +161,9 @@ pub fn query( context.introspect()?; } else { engine.sink.warn(warning!( - span, "calling `query` with a location is deprecated"; + span, + id: "deprecated", + message: "calling `query` with a location is deprecated"; hint: "try removing the location argument" )); } diff --git a/crates/typst/src/introspection/state.rs b/crates/typst/src/introspection/state.rs index a88ed526a..a1b87199a 100644 --- a/crates/typst/src/introspection/state.rs +++ b/crates/typst/src/introspection/state.rs @@ -335,7 +335,9 @@ impl State { context.location().at(span)?; } else { engine.sink.warn(warning!( - span, "calling `state.final` with a location is deprecated"; + span, + id: "deprecated", + message: "calling `state.final` with a location is deprecated"; hint: "try removing the location argument" )); } @@ -382,7 +384,9 @@ impl State { func: Option, ) -> Content { engine.sink.warn(warning!( - span, "`state.display` is deprecated"; + span, + id: "deprecated", + message: "`state.display` is deprecated"; hint: "use `state.get` in a `context` expression instead" )); diff --git a/crates/typst/src/layout/measure.rs b/crates/typst/src/layout/measure.rs index cb08e5913..8a4c16941 100644 --- a/crates/typst/src/layout/measure.rs +++ b/crates/typst/src/layout/measure.rs @@ -84,7 +84,9 @@ pub fn measure( let styles = match &styles { Some(styles) => { engine.sink.warn(warning!( - span, "calling `measure` with a styles argument is deprecated"; + span, + id: "deprecated", + message: "calling `measure` with a styles argument is deprecated"; hint: "try removing the styles argument" )); StyleChain::new(styles)