From 7d5bc110e2e3b98c39ea43e5d45ebb0ab7e8ccdd Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 26 Aug 2024 10:11:34 -0700 Subject: [PATCH] Update to derive_more v1.0 (#127) Summary: Pull Request resolved: https://github.com/facebook/starlark-rust/pull/127 Reviewed By: zertosh, dtolnay Differential Revision: D61429211 Pulled By: ndmitchell fbshipit-source-id: 90fef0f102791d83a3c46432d6260e8882379abd --- Cargo.toml | 2 +- starlark/Cargo.toml | 2 +- starlark/src/environment/methods.rs | 2 +- starlark/src/eval/bc/addr.rs | 2 +- starlark/src/eval/bc/stack_ptr.rs | 6 ++-- starlark/src/eval/compiler/def.rs | 3 +- .../compiler/def_inline/local_as_value.rs | 2 +- starlark/src/tests/derive/attrs.rs | 4 +-- starlark/src/tests/derive/module/methods.rs | 2 +- .../tests/derive/module/type_annotation.rs | 2 +- .../src/tests/derive/unpack_value_attr.rs | 4 +-- starlark/src/tests/docs.rs | 4 +-- starlark/src/tests/docs/rustdocs.rs | 4 +-- starlark/src/tests/interop.rs | 4 +-- starlark/src/tests/opt/if_rand.rs | 5 ++- starlark/src/tests/uncategorized.rs | 6 ++-- starlark/src/tests/util.rs | 2 +- starlark/src/typing/function.rs | 2 +- starlark/src/typing/oracle/traits.rs | 32 +++++++++---------- starlark/src/typing/user.rs | 6 ++-- starlark/src/values/demand.rs | 2 +- .../src/values/layout/alloc_static_simple.rs | 2 +- starlark/src/values/layout/avalue.rs | 2 +- .../src/values/layout/heap/call_enter_exit.rs | 4 +-- .../src/values/layout/heap/profile/arc_str.rs | 2 +- starlark/src/values/layout/value_captured.rs | 4 +-- starlark/src/values/traits.rs | 2 +- starlark/src/values/types/any.rs | 2 +- starlark/src/values/types/any_array.rs | 2 +- starlark/src/values/types/bigint.rs | 2 +- starlark/src/values/types/ellipsis.rs | 2 +- starlark/src/values/types/exported_name.rs | 2 +- starlark/src/values/types/function.rs | 8 ++--- starlark/src/values/types/none/none_type.rs | 2 +- starlark/src/values/types/string/iter.rs | 2 +- starlark/src/values/typing/any.rs | 2 +- starlark/src/values/typing/callable.rs | 4 +-- starlark/src/values/typing/iter.rs | 2 +- starlark/src/values/typing/never.rs | 2 +- starlark/src/values/typing/ty.rs | 2 +- starlark_lsp/Cargo.toml | 2 +- starlark_lsp/src/server.rs | 6 ++-- starlark_syntax/src/codemap.rs | 2 +- 43 files changed, 78 insertions(+), 80 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d80200882..46cc4c8a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ starlark_syntax = { version = "0.9", path = "starlark_syntax" } anyhow = "1.0.65" ctor = "0.1.26" derivative = "2.2" -derive_more = "0.99.3" +derive_more = { version = "1.0.0", features = ["full"] } either = "1.8" equivalent = "1.0.0" indenter = "0.3.3" diff --git a/starlark/Cargo.toml b/starlark/Cargo.toml index b6dc8442b..5c5224c7a 100644 --- a/starlark/Cargo.toml +++ b/starlark/Cargo.toml @@ -20,7 +20,7 @@ anyhow = "1.0.65" bumpalo = "3.8" debugserver-types = "0.5.0" derivative = "2.2" -derive_more = "0.99" +derive_more.workspace = true display_container = { workspace = true } dupe = { workspace = true } either = "1.8" diff --git a/starlark/src/environment/methods.rs b/starlark/src/environment/methods.rs index 447ab3d22..8e8c112ea 100644 --- a/starlark/src/environment/methods.rs +++ b/starlark/src/environment/methods.rs @@ -301,7 +301,7 @@ mod tests { #[test] fn test_set_attribute() { #[derive(Debug, Display, ProvidesStaticType, NoSerialize, Allocative)] - #[display(fmt = "Magic")] + #[display("Magic")] struct Magic; starlark_simple_value!(Magic); diff --git a/starlark/src/eval/bc/addr.rs b/starlark/src/eval/bc/addr.rs index 40ebe489e..ef4a619b6 100644 --- a/starlark/src/eval/bc/addr.rs +++ b/starlark/src/eval/bc/addr.rs @@ -37,7 +37,7 @@ use crate::eval::bc::repr::BC_INSTR_ALIGN; #[derive( Eq, PartialEq, Copy, Clone, Dupe, Debug, PartialOrd, Ord, Display, Hash, Default )] -#[display(fmt = "@{}", _0)] +#[display("@{}", _0)] pub(crate) struct BcAddr(pub(crate) u32); impl BcAddr { diff --git a/starlark/src/eval/bc/stack_ptr.rs b/starlark/src/eval/bc/stack_ptr.rs index 4ab27efb4..20b470255 100644 --- a/starlark/src/eval/bc/stack_ptr.rs +++ b/starlark/src/eval/bc/stack_ptr.rs @@ -36,7 +36,7 @@ use dupe::Dupe; Hash, derive_more::Display )] -#[display(fmt = "&{}", _0)] +#[display("&{}", _0)] pub(crate) struct BcSlot(pub(crate) u32); impl BcSlot { @@ -79,7 +79,7 @@ impl BcSlotsN { } #[derive(Copy, Clone, Dupe, Debug, derive_more::Display)] -#[display(fmt = "{}..{}", start, end)] +#[display("{}..{}", start, end)] pub(crate) struct BcSlotRange { pub(crate) start: BcSlot, pub(crate) end: BcSlot, @@ -129,7 +129,7 @@ impl BcSlotIn { } #[derive(Copy, Clone, Dupe, Debug, derive_more::Display)] -#[display(fmt = "{}..{}", start, end)] +#[display("{}..{}", start, end)] pub(crate) struct BcSlotInRange { pub(crate) start: BcSlotIn, pub(crate) end: BcSlotIn, diff --git a/starlark/src/eval/compiler/def.rs b/starlark/src/eval/compiler/def.rs index 45f692fe5..5e1752491 100644 --- a/starlark/src/eval/compiler/def.rs +++ b/starlark/src/eval/compiler/def.rs @@ -20,7 +20,6 @@ use std::cell::UnsafeCell; use std::collections::HashMap; use std::fmt; -use std::fmt::Display; use std::fmt::Write; use std::ptr; @@ -300,7 +299,7 @@ pub(crate) struct CopySlotFromParent { /// Static info for `def`, `lambda` or module. #[derive(Derivative, Display)] #[derivative(Debug)] -#[display(fmt = "DefInfo")] +#[display("DefInfo")] pub(crate) struct DefInfo { pub(crate) name: FrozenStringValue, /// Span of function signature. diff --git a/starlark/src/eval/compiler/def_inline/local_as_value.rs b/starlark/src/eval/compiler/def_inline/local_as_value.rs index 73fa6b30d..726e4b391 100644 --- a/starlark/src/eval/compiler/def_inline/local_as_value.rs +++ b/starlark/src/eval/compiler/def_inline/local_as_value.rs @@ -44,7 +44,7 @@ use crate::values::StarlarkValue; NoSerialize, Allocative )] -#[display(fmt = "{:?}", self)] +#[display("{:?}", self)] pub(crate) struct LocalAsValue { #[allocative(skip)] pub(crate) local: LocalSlotId, diff --git a/starlark/src/tests/derive/attrs.rs b/starlark/src/tests/derive/attrs.rs index 13a1b3d11..3c3ff7840 100644 --- a/starlark/src/tests/derive/attrs.rs +++ b/starlark/src/tests/derive/attrs.rs @@ -38,7 +38,7 @@ fn test_derive_attrs() { NoSerialize, Allocative )] - #[display(fmt = "{:?}", self)] + #[display("{:?}", self)] struct Example { hello: String, #[starlark(skip)] @@ -64,7 +64,7 @@ fn test_derive_attrs() { NoSerialize, Allocative )] - #[display(fmt = "{}", foo)] + #[display("{}", foo)] struct Nested { foo: String, } diff --git a/starlark/src/tests/derive/module/methods.rs b/starlark/src/tests/derive/module/methods.rs index c9c3c17a9..4f7ee5c20 100644 --- a/starlark/src/tests/derive/module/methods.rs +++ b/starlark/src/tests/derive/module/methods.rs @@ -40,7 +40,7 @@ use crate::values::ValueLike; NoSerialize, Allocative )] -#[display(fmt = "{:?}", self)] +#[display("{:?}", self)] struct Applaud { value: i32, } diff --git a/starlark/src/tests/derive/module/type_annotation.rs b/starlark/src/tests/derive/module/type_annotation.rs index 6848b8e58..50114d360 100644 --- a/starlark/src/tests/derive/module/type_annotation.rs +++ b/starlark/src/tests/derive/module/type_annotation.rs @@ -33,7 +33,7 @@ use crate::values::StarlarkValue; NoSerialize, Allocative )] -#[display(fmt = "foo")] +#[display("foo")] struct Foo; #[starlark_value(type = "Foo")] diff --git a/starlark/src/tests/derive/unpack_value_attr.rs b/starlark/src/tests/derive/unpack_value_attr.rs index b8f4875bf..e3832f88d 100644 --- a/starlark/src/tests/derive/unpack_value_attr.rs +++ b/starlark/src/tests/derive/unpack_value_attr.rs @@ -33,7 +33,7 @@ use crate::values::Value; ProvidesStaticType, Allocative )] -#[display(fmt = "ValueWithLifetimeParam")] +#[display("ValueWithLifetimeParam")] struct ValueWithLifetimeParam<'v>(Value<'v>); #[derive( Debug, @@ -42,7 +42,7 @@ struct ValueWithLifetimeParam<'v>(Value<'v>); ProvidesStaticType, Allocative )] -#[display(fmt = "ValueWithoutParam")] +#[display("ValueWithoutParam")] struct ValueWithoutParam(String); #[starlark_value(type = "ValueWithLifetimeParam", StarlarkTypeRepr, UnpackValue)] diff --git a/starlark/src/tests/docs.rs b/starlark/src/tests/docs.rs index 0cd59be8d..60c23c215 100644 --- a/starlark/src/tests/docs.rs +++ b/starlark/src/tests/docs.rs @@ -95,7 +95,7 @@ def _do_not_export(): Allocative, NoSerialize )] -#[display(fmt = "magic")] +#[display("magic")] struct Magic; #[starlark_value(type = "magic")] @@ -183,7 +183,7 @@ fn module(builder: &mut GlobalsBuilder) { } #[derive(ProvidesStaticType, Debug, Display, Allocative, Serialize)] -#[display(format = "obj")] +#[display("obj")] struct Obj; #[starlark_value(type = "obj")] diff --git a/starlark/src/tests/docs/rustdocs.rs b/starlark/src/tests/docs/rustdocs.rs index e60eab1ae..d0668f224 100644 --- a/starlark/src/tests/docs/rustdocs.rs +++ b/starlark/src/tests/docs/rustdocs.rs @@ -47,7 +47,7 @@ use crate::values::ValueOfUnchecked; NoSerialize, ProvidesStaticType )] -#[display(fmt = "input")] +#[display("input")] struct InputTypeRepr; #[derive( Debug, @@ -56,7 +56,7 @@ struct InputTypeRepr; NoSerialize, ProvidesStaticType )] -#[display(fmt = "output")] +#[display("output")] struct OutputTypeRepr; #[starlark_value(type = "input")] diff --git a/starlark/src/tests/interop.rs b/starlark/src/tests/interop.rs index be434220a..952166e3e 100644 --- a/starlark/src/tests/interop.rs +++ b/starlark/src/tests/interop.rs @@ -192,7 +192,7 @@ fn test_load_symbols_extra() -> crate::Result<()> { NoSerialize, Allocative )] - #[display(fmt = "{:?}", self)] + #[display("{:?}", self)] struct Extra<'v>(Arc>>>); #[starlark_value(type = "Extra")] @@ -224,7 +224,7 @@ fn test_load_symbols_extra() -> crate::Result<()> { #[test] fn test_repr_str() { #[derive(ProvidesStaticType, Debug, Display)] - #[display(fmt = "{:?}", self)] + #[display("{:?}", self)] struct Foo(Option); #[starlark_module] diff --git a/starlark/src/tests/opt/if_rand.rs b/starlark/src/tests/opt/if_rand.rs index d05fe87ac..db224c51d 100644 --- a/starlark/src/tests/opt/if_rand.rs +++ b/starlark/src/tests/opt/if_rand.rs @@ -19,7 +19,6 @@ use std::cell::Cell; use std::fmt; -use std::fmt::Display; use derive_more::Display; use dupe::Dupe; @@ -76,9 +75,9 @@ fn bool_fns(globals: &mut GlobalsBuilder) { #[derive(Display, Debug, Copy, Clone, Dupe)] enum TestBinOp { - #[display(fmt = "and")] + #[display("and")] And, - #[display(fmt = "or")] + #[display("or")] Or, } diff --git a/starlark/src/tests/uncategorized.rs b/starlark/src/tests/uncategorized.rs index bdf81d0b2..99b734b88 100644 --- a/starlark/src/tests/uncategorized.rs +++ b/starlark/src/tests/uncategorized.rs @@ -286,7 +286,7 @@ fn test_radd() { // We want select append to always produce a select, much like the // Bazel/Buck `select` function. #[derive(Debug, Display, Clone, ProvidesStaticType, NoSerialize, Allocative)] - #[display(fmt = "${:?}", _0)] + #[display("${:?}", _0)] struct Select(Vec); starlark_simple_value!(Select); @@ -757,7 +757,7 @@ fn test_label_assign() { // No builtin Starlark types support it, so we have to define a custom type (wapping a dictionary) #[derive(Debug, Trace, ProvidesStaticType, Display, NoSerialize, Allocative)] - #[display(fmt = "{:?}", self)] + #[display("{:?}", self)] struct Wrapper<'v>(RefCell>>); #[starlark_value(type = "wrapper")] @@ -773,7 +773,7 @@ fn test_label_assign() { } #[derive(Debug, ProvidesStaticType, Display, NoSerialize, Allocative)] - #[display(fmt = "FrozenWrapper")] + #[display("FrozenWrapper")] struct FrozenWrapper; #[starlark_value(type = "wrapper")] diff --git a/starlark/src/tests/util.rs b/starlark/src/tests/util.rs index 28c57d4a5..81d0cb4a1 100644 --- a/starlark/src/tests/util.rs +++ b/starlark/src/tests/util.rs @@ -44,7 +44,7 @@ use crate::values::ValueLike; ProvidesStaticType, NoSerialize )] -#[display(fmt = "TestComplexValue<{}>", "_0")] +#[display("TestComplexValue<{}>", _0)] pub(crate) struct TestComplexValue(pub(crate) V); #[starlark_value(type = "TestComplexValue")] diff --git a/starlark/src/typing/function.rs b/starlark/src/typing/function.rs index 023e95487..3fea75b4d 100644 --- a/starlark/src/typing/function.rs +++ b/starlark/src/typing/function.rs @@ -82,7 +82,7 @@ pub trait TyCustomFunctionImpl: Debug, derive_more::Display )] -#[display(fmt = "\"function\"")] +#[display("\"function\"")] pub struct TyCustomFunction(pub F); impl TyCustomImpl for TyCustomFunction { diff --git a/starlark/src/typing/oracle/traits.rs b/starlark/src/typing/oracle/traits.rs index b7a99b6e9..b91fd3915 100644 --- a/starlark/src/typing/oracle/traits.rs +++ b/starlark/src/typing/oracle/traits.rs @@ -24,13 +24,13 @@ use dupe::Dupe; #[derive(Copy, Clone, Dupe, Eq, PartialEq, derive_more::Display, Debug)] pub enum TypingUnOp { /// `+`. - #[display(fmt = "+")] + #[display("+")] Plus, /// `+`. - #[display(fmt = "-")] + #[display("-")] Minus, /// `~`. - #[display(fmt = "~")] + #[display("~")] BitNot, } @@ -38,43 +38,43 @@ pub enum TypingUnOp { #[derive(Copy, Clone, Dupe, Eq, PartialEq, derive_more::Display, Debug)] pub enum TypingBinOp { /// `+`. - #[display(fmt = "+")] + #[display("+")] Add, /// `-`. - #[display(fmt = "-")] + #[display("-")] Sub, /// `/`. - #[display(fmt = "/")] + #[display("/")] Div, /// `//`. - #[display(fmt = "/")] + #[display("/")] FloorDiv, /// `*`. - #[display(fmt = "*")] + #[display("*")] Mul, /// `%`. - #[display(fmt = "%")] + #[display("%")] Percent, /// `y in x`. - #[display(fmt = "in")] + #[display("in")] In, /// `|`. - #[display(fmt = "|")] + #[display("|")] BitOr, /// `^`. - #[display(fmt = "^")] + #[display("^")] BitXor, /// `&`. - #[display(fmt = "&")] + #[display("&")] BitAnd, /// `<`. - #[display(fmt = "<")] + #[display("<")] Less, /// `<<`. - #[display(fmt = "<<")] + #[display("<<")] LeftShift, /// `>>`. - #[display(fmt = ">>")] + #[display(">>")] RightShift, } diff --git a/starlark/src/typing/user.rs b/starlark/src/typing/user.rs index 7e263aa07..eb7b116ec 100644 --- a/starlark/src/typing/user.rs +++ b/starlark/src/typing/user.rs @@ -116,7 +116,7 @@ pub struct TyUserParams { /// Type description for arbitrary type. #[derive(Allocative, Debug, derive_more::Display)] -#[display(fmt = "{}", name)] +#[display("{}", name)] pub struct TyUser { name: String, /// Base type for this custom type, e.g. generic record for record with known fields. @@ -318,7 +318,7 @@ mod tests { Allocative, NoSerialize )] - #[display(fmt = "plant")] + #[display("plant")] enum AbstractPlant {} #[starlark_value(type = "plant")] @@ -335,7 +335,7 @@ mod tests { Allocative, NoSerialize )] - #[display(fmt = "fruit_callable")] + #[display("fruit_callable")] struct FruitCallable { name: String, ty_fruit_callable: Ty, diff --git a/starlark/src/values/demand.rs b/starlark/src/values/demand.rs index f60c057c0..bfee6ad8b 100644 --- a/starlark/src/values/demand.rs +++ b/starlark/src/values/demand.rs @@ -94,7 +94,7 @@ mod tests { NoSerialize, Allocative )] - #[display(fmt = "SomeType")] + #[display("SomeType")] struct MyValue { payload: u32, } diff --git a/starlark/src/values/layout/alloc_static_simple.rs b/starlark/src/values/layout/alloc_static_simple.rs index c220f4c48..d94c0cb18 100644 --- a/starlark/src/values/layout/alloc_static_simple.rs +++ b/starlark/src/values/layout/alloc_static_simple.rs @@ -65,7 +65,7 @@ mod tests { NoSerialize, Allocative )] - #[display(fmt = "MySimpleValue")] + #[display("MySimpleValue")] struct MySimpleValue(u32); #[starlark_value(type = "MySimpleValue")] diff --git a/starlark/src/values/layout/avalue.rs b/starlark/src/values/layout/avalue.rs index 5d0e9962d..334c14079 100644 --- a/starlark/src/values/layout/avalue.rs +++ b/starlark/src/values/layout/avalue.rs @@ -714,7 +714,7 @@ where } #[derive(Debug, Display, ProvidesStaticType, Allocative)] -#[display(fmt = "BlackHole")] +#[display("BlackHole")] pub(crate) struct BlackHole(pub(crate) ValueAllocSize); #[cfg(test)] diff --git a/starlark/src/values/layout/heap/call_enter_exit.rs b/starlark/src/values/layout/heap/call_enter_exit.rs index 5ea005535..f9313351e 100644 --- a/starlark/src/values/layout/heap/call_enter_exit.rs +++ b/starlark/src/values/layout/heap/call_enter_exit.rs @@ -59,7 +59,7 @@ impl MaybeDrop for NoDrop {} NoSerialize, Allocative )] -#[display(fmt = "CallEnter")] +#[display("CallEnter")] pub(crate) struct CallEnter<'v, D: MaybeDrop + 'static> { pub(crate) function: Value<'v>, pub(crate) time: ProfilerInstant, @@ -78,7 +78,7 @@ impl<'v, D: MaybeDrop + Trace<'v> + 'v> StarlarkValue<'v> for CallEnter<'v, D> { NoSerialize, Allocative )] -#[display(fmt = "CallExit")] +#[display("CallExit")] pub(crate) struct CallExit { pub(crate) time: ProfilerInstant, pub(crate) maybe_drop: D, diff --git a/starlark/src/values/layout/heap/profile/arc_str.rs b/starlark/src/values/layout/heap/profile/arc_str.rs index 64405fe20..3eaaa92b9 100644 --- a/starlark/src/values/layout/heap/profile/arc_str.rs +++ b/starlark/src/values/layout/heap/profile/arc_str.rs @@ -38,7 +38,7 @@ use crate::util::arc_or_static::ArcOrStatic; derive_more::Display, Allocative )] -#[display(fmt = "{}", "&**self")] +#[display("{}", &**self)] pub(crate) struct ArcStr(ArcOrStatic); impl ArcStr { diff --git a/starlark/src/values/layout/value_captured.rs b/starlark/src/values/layout/value_captured.rs index dd7694e1d..d58869a27 100644 --- a/starlark/src/values/layout/value_captured.rs +++ b/starlark/src/values/layout/value_captured.rs @@ -38,13 +38,13 @@ use crate::values::Value; use crate::values::ValueLike; #[derive(Debug, Trace, ProvidesStaticType, Display, NoSerialize, Allocative)] -#[display(fmt = "{:?}", self)] // This type should never be user visible +#[display("{:?}", self)] // This type should never be user visible #[repr(transparent)] #[allocative(skip)] pub(crate) struct ValueCaptured<'v>(Cell>>); #[derive(Debug, ProvidesStaticType, Display, NoSerialize, Allocative)] -#[display(fmt = "{:?}", self)] // Type is not user visible +#[display("{:?}", self)] // Type is not user visible #[repr(transparent)] pub(crate) struct FrozenValueCaptured(Option); diff --git a/starlark/src/values/traits.rs b/starlark/src/values/traits.rs index a7374a96c..ea4558a8c 100644 --- a/starlark/src/values/traits.rs +++ b/starlark/src/values/traits.rs @@ -216,7 +216,7 @@ where /// use starlark_derive::starlark_value; /// /// #[derive(Debug, Display, ProvidesStaticType, NoSerialize, Allocative)] -/// #[display(fmt = "Foo")] +/// #[display("Foo")] /// struct Foo; /// # starlark_simple_value!(Foo); /// #[starlark_value(type = "foo")] diff --git a/starlark/src/values/types/any.rs b/starlark/src/values/types/any.rs index 93c66307e..49cd014c2 100644 --- a/starlark/src/values/types/any.rs +++ b/starlark/src/values/types/any.rs @@ -90,7 +90,7 @@ use crate::values::ValueLike; /// [`StarlarkAnyComplex`](crate::values::types::any_complex::StarlarkAnyComplex). #[derive(ProvidesStaticType, NoSerialize, Allocative, derive_more::Display)] #[allocative(bound = "")] -#[display(fmt = "{:?}", "self")] +#[display("{:?}", self)] pub struct StarlarkAny( #[allocative(skip)] // TODO(nga): do not skip. pub T, diff --git a/starlark/src/values/types/any_array.rs b/starlark/src/values/types/any_array.rs index aa529786b..5188d819d 100644 --- a/starlark/src/values/types/any_array.rs +++ b/starlark/src/values/types/any_array.rs @@ -32,7 +32,7 @@ use crate::values::StarlarkValue; #[derive(derive_more::Display, ProvidesStaticType, NoSerialize, Allocative)] #[repr(C)] -#[display(fmt = "{:?}", self)] +#[display("{:?}", self)] #[allocative(bound = "")] pub(crate) struct AnyArray { pub(crate) len: usize, diff --git a/starlark/src/values/types/bigint.rs b/starlark/src/values/types/bigint.rs index eacbd782c..af1fbdad7 100644 --- a/starlark/src/values/types/bigint.rs +++ b/starlark/src/values/types/bigint.rs @@ -65,7 +65,7 @@ use crate::values::ValueError; Hash, Allocative )] -#[display(fmt = "{}", value)] +#[display("{}", value)] pub struct StarlarkBigInt { /// `value` is strictly either smaller than `i32::MIN` or larger than `i32::MAX`. /// Many operation implementations depend on this fact. diff --git a/starlark/src/values/types/ellipsis.rs b/starlark/src/values/types/ellipsis.rs index 502c46620..af5d3cc89 100644 --- a/starlark/src/values/types/ellipsis.rs +++ b/starlark/src/values/types/ellipsis.rs @@ -37,7 +37,7 @@ use crate::values::StarlarkValue; derive_more::Display, ProvidesStaticType )] -#[display(fmt = "Ellipsis")] +#[display("Ellipsis")] pub(crate) struct Ellipsis; pub(crate) static VALUE_ELLIPSIS: AValueRepr>> = diff --git a/starlark/src/values/types/exported_name.rs b/starlark/src/values/types/exported_name.rs index 2188f1865..5677ae0c8 100644 --- a/starlark/src/values/types/exported_name.rs +++ b/starlark/src/values/types/exported_name.rs @@ -77,7 +77,7 @@ impl<'a> Eq for BorrowedExportedName<'a> {} /// Allocative, /// derive_more::Display /// )] -/// #[display(fmt = "{:?}", "self")] +/// #[display("{:?}", self)] /// struct MyStruct { /// name: T, /// } diff --git a/starlark/src/values/types/function.rs b/starlark/src/values/types/function.rs index c4666cfcd..5ff6f39a2 100644 --- a/starlark/src/values/types/function.rs +++ b/starlark/src/values/types/function.rs @@ -195,7 +195,7 @@ impl NativeCallableRawDocs { /// Almost always created with [`#[starlark_module]`](macro@crate::starlark_module). #[derive(Derivative, ProvidesStaticType, Display, NoSerialize, Allocative)] #[derivative(Debug)] -#[display(fmt = "{}", name)] +#[display("{}", name)] pub struct NativeFunction { #[derivative(Debug = "ignore")] #[allocative(skip)] @@ -357,7 +357,7 @@ impl<'v> StarlarkValue<'v> for NativeFunction { #[derive(Derivative, Display, NoSerialize, ProvidesStaticType, Allocative)] #[derivative(Debug)] -#[display(fmt = "{}", name)] +#[display("{}", name)] pub(crate) struct NativeMethod { #[derivative(Debug = "ignore")] #[allocative(skip)] @@ -388,7 +388,7 @@ impl<'v> StarlarkValue<'v> for NativeMethod { /// Used by the `#[starlark(attribute)]` tag of [`#[starlark_module]`](macro@starlark_module) /// to define a function that pretends to be an attribute. #[derive(Derivative, Display, NoSerialize, ProvidesStaticType, Allocative)] -#[display(fmt = "Attribute")] +#[display("Attribute")] #[derivative(Debug)] pub(crate) struct NativeAttribute { /// Safe to evaluate speculatively. @@ -440,7 +440,7 @@ impl<'v> StarlarkValue<'v> for NativeAttribute { Allocative )] #[repr(C)] -#[display(fmt = "{}", method)] +#[display("{}", method)] pub(crate) struct BoundMethodGen { pub(crate) method: FrozenValueTyped<'static, NativeMethod>, pub(crate) this: V, diff --git a/starlark/src/values/types/none/none_type.rs b/starlark/src/values/types/none/none_type.rs index 0b93f9d48..073d247d0 100644 --- a/starlark/src/values/types/none/none_type.rs +++ b/starlark/src/values/types/none/none_type.rs @@ -46,7 +46,7 @@ use crate::values::Value; /// Define the None type, use [`NoneType`] in Rust. #[derive(Debug, Clone, Dupe, ProvidesStaticType, Display, Allocative)] -#[display(fmt = "None")] +#[display("None")] pub struct NoneType; impl NoneType { diff --git a/starlark/src/values/types/string/iter.rs b/starlark/src/values/types/string/iter.rs index 6a53b93d6..a953d45e5 100644 --- a/starlark/src/values/types/string/iter.rs +++ b/starlark/src/values/types/string/iter.rs @@ -47,7 +47,7 @@ use crate::values::ValueOfUnchecked; ProvidesStaticType, Allocative )] -#[display(fmt = "iterator")] +#[display("iterator")] #[repr(C)] struct StringIterableGen<'v, V: ValueLike<'v>> { string: V::String, diff --git a/starlark/src/values/typing/any.rs b/starlark/src/values/typing/any.rs index 328ea2c34..053ac8e31 100644 --- a/starlark/src/values/typing/any.rs +++ b/starlark/src/values/typing/any.rs @@ -38,7 +38,7 @@ use crate::values::StarlarkValue; ProvidesStaticType, NoSerialize )] -#[display(fmt = "{}", Self::TYPE)] +#[display("{}", Self::TYPE)] pub(crate) struct TypingAny; #[starlark_value(type = "typing.Any")] diff --git a/starlark/src/values/typing/callable.rs b/starlark/src/values/typing/callable.rs index 3a673bb62..3553f049e 100644 --- a/starlark/src/values/typing/callable.rs +++ b/starlark/src/values/typing/callable.rs @@ -66,7 +66,7 @@ use crate::values::Value; ProvidesStaticType, NoSerialize )] -#[display(fmt = "{}", Self::TYPE)] +#[display("{}", Self::TYPE)] pub(crate) struct TypingCallable; #[starlark_value(type = "typing.Callable")] @@ -112,7 +112,7 @@ impl AllocFrozenValue for TypingCallable { NoSerialize, derive_more::Display )] -#[display(fmt = "{}", "callable")] +#[display("{}", callable)] pub(crate) struct TypingCallableAt2 { callable: TyCallable, } diff --git a/starlark/src/values/typing/iter.rs b/starlark/src/values/typing/iter.rs index 6b5be30b2..7bfdd3956 100644 --- a/starlark/src/values/typing/iter.rs +++ b/starlark/src/values/typing/iter.rs @@ -54,7 +54,7 @@ impl StarlarkTypeRepr for StarlarkIter { ProvidesStaticType, NoSerialize )] -#[display(fmt = "{}", Self::TYPE)] +#[display("{}", Self::TYPE)] pub(crate) struct TypingIterable; #[starlark_value(type = "typing.Iterable")] diff --git a/starlark/src/values/typing/never.rs b/starlark/src/values/typing/never.rs index 45a15d53c..219de5eb8 100644 --- a/starlark/src/values/typing/never.rs +++ b/starlark/src/values/typing/never.rs @@ -57,7 +57,7 @@ use crate::values::StarlarkValue; ProvidesStaticType, NoSerialize )] -#[display(fmt = "{}", Self::TYPE)] +#[display("{}", Self::TYPE)] pub(crate) struct TypingNever; #[starlark_value(type = "typing.Never")] diff --git a/starlark/src/values/typing/ty.rs b/starlark/src/values/typing/ty.rs index 0f0f67a6d..93900b190 100644 --- a/starlark/src/values/typing/ty.rs +++ b/starlark/src/values/typing/ty.rs @@ -33,7 +33,7 @@ use crate::values::StarlarkValue; ProvidesStaticType, NoSerialize )] -#[display(fmt = "type")] +#[display("type")] pub enum AbstractType {} #[starlark_value(type = "type")] diff --git a/starlark_lsp/Cargo.toml b/starlark_lsp/Cargo.toml index 03d0ffc12..87dc9be66 100644 --- a/starlark_lsp/Cargo.toml +++ b/starlark_lsp/Cargo.toml @@ -16,7 +16,7 @@ version = "0.12.0" [dependencies] anyhow = "1.0.65" derivative = "2.2" -derive_more = "0.99" +derive_more.workspace = true dupe = { workspace = true } itertools = "0.10" lsp-server = "0.7.2" diff --git a/starlark_lsp/src/server.rs b/starlark_lsp/src/server.rs index e5d39e93c..fe361e4a9 100644 --- a/starlark_lsp/src/server.rs +++ b/starlark_lsp/src/server.rs @@ -148,14 +148,14 @@ pub enum LspUrlError { #[derive(Clone, Debug, Hash, Eq, PartialEq, Display)] pub enum LspUrl { /// A "file://" url with a path sent from the LSP client. - #[display(fmt = "file://{}", "_0.display()")] + #[display("file://{}", _0.display())] File(PathBuf), /// A "starlark:" url. This is mostly used for native types that don't actually /// exist on the filesystem. The path component always has a leading slash. - #[display(fmt = "starlark:{}", "_0.display()")] + #[display("starlark:{}", _0.display())] Starlark(PathBuf), /// Any other type. Often should just be ignored, or return an error. - #[display(fmt = "{}", "_0")] + #[display("{}", _0)] Other(Url), } diff --git a/starlark_syntax/src/codemap.rs b/starlark_syntax/src/codemap.rs index 6d779415a..a6228907b 100644 --- a/starlark_syntax/src/codemap.rs +++ b/starlark_syntax/src/codemap.rs @@ -691,7 +691,7 @@ impl ResolvedSpan { /// File and line number. #[derive(Debug, PartialEq, Eq, Hash, Clone, derive_more::Display)] -#[display(fmt = "{}:{}", file, "line + 1")] +#[display("{}:{}", file, line + 1)] pub struct ResolvedFileLine { /// File name. pub file: String,