Simplify some paths
This commit is contained in:
parent
d93ed1b3d8
commit
010084e2d6
@ -738,14 +738,12 @@ impl Array {
|
||||
vec.make_mut().sort_by(|a, b| {
|
||||
// Until we get `try` blocks :)
|
||||
match (key_of(a.clone()), key_of(b.clone())) {
|
||||
(Ok(a), Ok(b)) => {
|
||||
typst::eval::ops::compare(&a, &b).unwrap_or_else(|err| {
|
||||
if result.is_ok() {
|
||||
result = Err(err).at(span);
|
||||
}
|
||||
Ordering::Equal
|
||||
})
|
||||
}
|
||||
(Ok(a), Ok(b)) => super::ops::compare(&a, &b).unwrap_or_else(|err| {
|
||||
if result.is_ok() {
|
||||
result = Err(err).at(span);
|
||||
}
|
||||
Ordering::Equal
|
||||
}),
|
||||
(Err(e), _) | (_, Err(e)) => {
|
||||
if result.is_ok() {
|
||||
result = Err(e);
|
||||
@ -794,7 +792,7 @@ impl Array {
|
||||
}
|
||||
|
||||
for second in out.iter() {
|
||||
if typst::eval::ops::equal(&key, &key_of(second.clone())?) {
|
||||
if super::ops::equal(&key, &key_of(second.clone())?) {
|
||||
continue 'outer;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ pub trait Reflect {
|
||||
/// Produce an error message for an inacceptable value.
|
||||
///
|
||||
/// ```
|
||||
/// # use typst::eval::{Int, Reflect, Value};
|
||||
/// assert_eq!(
|
||||
/// <Int as Reflect>::error(Value::None),
|
||||
/// "expected integer, found none",
|
||||
|
@ -9,13 +9,12 @@ use serde::de::value::{MapAccessDeserializer, SeqAccessDeserializer};
|
||||
use serde::de::{Error, MapAccess, SeqAccess, Visitor};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use siphasher::sip128::{Hasher128, SipHasher13};
|
||||
use typst::eval::Duration;
|
||||
|
||||
use super::repr::{format_float, format_int_with_base};
|
||||
use super::{
|
||||
fields, ops, Args, Array, AutoValue, Bytes, CastInfo, Content, Dict, FromValue, Func,
|
||||
IntoValue, Module, NativeType, NoneValue, Plugin, Reflect, Repr, Scope, Str, Symbol,
|
||||
Type, Version,
|
||||
fields, ops, Args, Array, AutoValue, Bytes, CastInfo, Content, Dict, Duration,
|
||||
FromValue, Func, IntoValue, Module, NativeType, NoneValue, Plugin, Reflect, Repr,
|
||||
Scope, Str, Symbol, Type, Version,
|
||||
};
|
||||
use crate::diag::StrResult;
|
||||
use crate::eval::{item, Datetime};
|
||||
|
@ -219,7 +219,7 @@ pub trait NativeElement: Debug + Repr + Construct + Set + Send + Sync + 'static
|
||||
fn set_label(&mut self, label: Label);
|
||||
|
||||
/// Set the element's label.
|
||||
fn labelled(mut self, label: ::typst::model::Label) -> Self
|
||||
fn labelled(mut self, label: Label) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
|
@ -26,12 +26,12 @@ macro_rules! __select_where {
|
||||
let mut fields = ::smallvec::SmallVec::new();
|
||||
$(
|
||||
fields.push((
|
||||
<$ty as ::typst::model::ElementFields>::Fields::$field as u8,
|
||||
<$ty as $crate::model::ElementFields>::Fields::$field as u8,
|
||||
$crate::eval::IntoValue::into_value($value),
|
||||
));
|
||||
)*
|
||||
::typst::model::Selector::Elem(
|
||||
<$ty as ::typst::model::NativeElement>::elem(),
|
||||
$crate::model::Selector::Elem(
|
||||
<$ty as $crate::model::NativeElement>::elem(),
|
||||
Some(fields),
|
||||
)
|
||||
}};
|
||||
|
Loading…
x
Reference in New Issue
Block a user