diff --git a/.gitignore b/.gitignore index 96ef6c0..9d9413f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.vim diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d1a29..214a153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## `0.8.6 + +* Update to `automerge` 0.6.0 + ## `0.8.5` * Implement `PartialEq` and `Eq` for `Text` diff --git a/Cargo.toml b/Cargo.toml index e4da2e0..2efd1da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,5 +13,5 @@ repository = "https://github.com/automerge/autosurgeon" license = "MIT" [workspace.dependencies] -automerge = "0.5" -automerge-test = "0.4" +automerge = "0.6" +automerge-test = "0.5" diff --git a/autosurgeon-derive/Cargo.toml b/autosurgeon-derive/Cargo.toml index 23240b9..a474651 100644 --- a/autosurgeon-derive/Cargo.toml +++ b/autosurgeon-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "autosurgeon-derive" -version = "0.8.0" +version = "0.8.1" authors = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } diff --git a/autosurgeon-derive/src/reconcile/enum_impl.rs b/autosurgeon-derive/src/reconcile/enum_impl.rs index 889fc57..9cf4cda 100644 --- a/autosurgeon-derive/src/reconcile/enum_impl.rs +++ b/autosurgeon-derive/src/reconcile/enum_impl.rs @@ -62,7 +62,7 @@ impl<'a> TryFrom<&'a syn::Variant> for Variant<'a> { } } -impl<'a> Variant<'a> { +impl Variant<'_> { fn match_arm( &self, reconciler_ident: &syn::Ident, @@ -155,7 +155,7 @@ enum EnumKeyInnerType<'a> { NoInnerKeyTuple, } -impl<'a> EnumKeyInnerType<'a> { +impl EnumKeyInnerType<'_> { fn get_key(&self, key_type_name: &syn::Ident, variant_name: &syn::Ident) -> TokenStream { match self { Self::Unit => { @@ -340,7 +340,7 @@ struct EnumKeyVariant<'a> { ty: EnumKeyInnerType<'a>, } -impl<'a> EnumKeyVariant<'a> { +impl EnumKeyVariant<'_> { fn non_unit_match_arm( &self, outer_name: &syn::Ident, @@ -642,7 +642,7 @@ struct EnumUnnamedField<'a> { attrs: attrs::Field, } -impl<'a> VariantField for EnumUnnamedField<'a> { +impl VariantField for EnumUnnamedField<'_> { fn name(&self) -> syn::Ident { format_ident!("field_{}", self.idx) } @@ -652,13 +652,13 @@ impl<'a> VariantField for EnumUnnamedField<'a> { } } -impl<'a> EnumUnnamedField<'a> { +impl EnumUnnamedField<'_> { fn name(&self) -> syn::Ident { format_ident!("field_{}", self.idx) } } -impl<'a> Field for EnumUnnamedField<'a> { +impl Field for EnumUnnamedField<'_> { fn attrs(&self) -> &[syn::Attribute] { &self.field.attrs } @@ -699,7 +699,7 @@ struct EnumNamedField<'a> { name: &'a syn::Ident, } -impl<'a> VariantField for EnumNamedField<'a> { +impl VariantField for EnumNamedField<'_> { fn name(&self) -> syn::Ident { self.name.clone() } diff --git a/autosurgeon-derive/src/reconcile/struct_impl.rs b/autosurgeon-derive/src/reconcile/struct_impl.rs index 2c837b5..5b77c07 100644 --- a/autosurgeon-derive/src/reconcile/struct_impl.rs +++ b/autosurgeon-derive/src/reconcile/struct_impl.rs @@ -139,7 +139,7 @@ impl<'a> NamedField<'a> { } } -impl<'a> Field for NamedField<'a> { +impl Field for NamedField<'_> { fn attrs(&self) -> &[syn::Attribute] { &self.field.attrs } @@ -202,7 +202,7 @@ impl<'a> TupleField<'a> { } } -impl<'a> Field for TupleField<'a> { +impl Field for TupleField<'_> { fn attrs(&self) -> &[syn::Attribute] { &self.field.attrs } diff --git a/autosurgeon/Cargo.toml b/autosurgeon/Cargo.toml index 6841382..e1aac46 100644 --- a/autosurgeon/Cargo.toml +++ b/autosurgeon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "autosurgeon" -version = "0.8.5" +version = "0.8.6" authors = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } @@ -11,7 +11,7 @@ license = { workspace = true } [dependencies] automerge = { workspace = true } -autosurgeon-derive = { path = "../autosurgeon-derive", version = "0.8.0" } +autosurgeon-derive = { path = "../autosurgeon-derive", version = "0.8.1" } similar = { version = "2.2.1", features = ["unicode"] } thiserror = "1.0.37" uuid = { version = "1.2.2", optional = true } diff --git a/autosurgeon/src/doc.rs b/autosurgeon/src/doc.rs index 22aa123..b5f40bf 100644 --- a/autosurgeon/src/doc.rs +++ b/autosurgeon/src/doc.rs @@ -135,8 +135,11 @@ impl ReadDoc for am::AutoCommit { } } -impl<'a> ReadDoc for am::transaction::Transaction<'a> { - type Parents<'b> = am::Parents<'b> where Self: 'b; +impl ReadDoc for am::transaction::Transaction<'_> { + type Parents<'b> + = am::Parents<'b> + where + Self: 'b; fn get_heads(&self) -> Vec { am::transaction::Transactable::base_heads(self) } diff --git a/autosurgeon/src/hydrate/impls.rs b/autosurgeon/src/hydrate/impls.rs index f19d6de..6a11815 100644 --- a/autosurgeon/src/hydrate/impls.rs +++ b/autosurgeon/src/hydrate/impls.rs @@ -100,7 +100,7 @@ impl Hydrate for Option { } } -impl<'a, T: Hydrate + Clone> Hydrate for Cow<'a, T> { +impl Hydrate for Cow<'_, T> { fn hydrate( doc: &D, obj: &automerge::ObjId, diff --git a/autosurgeon/src/lib.rs b/autosurgeon/src/lib.rs index 698ff7c..3be1394 100644 --- a/autosurgeon/src/lib.rs +++ b/autosurgeon/src/lib.rs @@ -18,7 +18,7 @@ //! ## Feature Flags //! //! * `uuid` - Includes implementations of `Reconcile` and `Hydrate` for the [`Uuid`](https://docs.rs/uuid/latest/uuid/) crate which will -//! reconcile to a [`automerge::ScalarValue::Bytes`] +//! reconcile to a [`automerge::ScalarValue::Bytes`] //! //! ## Example //! diff --git a/autosurgeon/src/prop.rs b/autosurgeon/src/prop.rs index 5353f1e..aad7d9e 100644 --- a/autosurgeon/src/prop.rs +++ b/autosurgeon/src/prop.rs @@ -7,7 +7,7 @@ pub enum Prop<'a> { Index(u32), } -impl<'a> std::fmt::Display for Prop<'a> { +impl std::fmt::Display for Prop<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Key(s) => write!(f, "{}", s), @@ -16,7 +16,7 @@ impl<'a> std::fmt::Display for Prop<'a> { } } -impl<'a> From<&Prop<'a>> for automerge::Prop { +impl From<&Prop<'_>> for automerge::Prop { fn from(p: &Prop) -> Self { match p { Prop::Key(k) => automerge::Prop::Map(k.to_string()), @@ -49,7 +49,7 @@ impl<'a> From<&'a str> for Prop<'a> { } } -impl<'a> From for Prop<'a> { +impl From for Prop<'_> { fn from(p: am::Prop) -> Self { match p { am::Prop::Map(k) => Prop::Key(Cow::Owned(k)), diff --git a/autosurgeon/src/reconcile.rs b/autosurgeon/src/reconcile.rs index 53adad3..f34abf3 100644 --- a/autosurgeon/src/reconcile.rs +++ b/autosurgeon/src/reconcile.rs @@ -415,14 +415,22 @@ struct RootReconciler<'a, D> { impl<'a, D: Doc> Reconciler for RootReconciler<'a, D> { type Error = ReconcileError; - type Map<'b> = InMap<'b, D> - where Self: 'b; - type Seq<'b> = InSeq<'b, D> - where Self: 'b; - type Text<'b> = InText<'b, D> - where Self: 'b; - type Counter<'b> = AtCounter<'b, D> - where Self: 'b; + type Map<'b> + = InMap<'b, D> + where + Self: 'b; + type Seq<'b> + = InSeq<'b, D> + where + Self: 'b; + type Text<'b> + = InText<'b, D> + where + Self: 'b; + type Counter<'b> + = AtCounter<'b, D> + where + Self: 'b; fn none(&mut self) -> Result<(), Self::Error> { Err(ReconcileError::TopLevelNotMap) @@ -486,7 +494,7 @@ enum PropAction<'a> { Insert(u32), } -impl<'a> PropAction<'a> { +impl PropAction<'_> { fn get_target<'b, D: Doc>( &self, doc: &'b D, @@ -530,16 +538,24 @@ struct PropReconciler<'a, D> { action: PropAction<'a>, } -impl<'a, D: Doc> Reconciler for PropReconciler<'a, D> { +impl Reconciler for PropReconciler<'_, D> { type Error = ReconcileError; - type Map<'b> = InMap<'b, D> - where Self: 'b; - type Seq<'b> = InSeq<'b, D> - where Self: 'b; - type Text<'b> = InText<'b, D> - where Self: 'b; - type Counter<'b> = AtCounter<'b, D> - where Self: 'b; + type Map<'b> + = InMap<'b, D> + where + Self: 'b; + type Seq<'b> + = InSeq<'b, D> + where + Self: 'b; + type Text<'b> + = InText<'b, D> + where + Self: 'b; + type Counter<'b> + = AtCounter<'b, D> + where + Self: 'b; fn none(&mut self) -> Result<(), Self::Error> { self.action @@ -659,7 +675,7 @@ struct AtCounter<'a, D> { action: &'a PropAction<'a>, } -impl<'a, D: Doc> CounterReconciler for AtCounter<'a, D> { +impl CounterReconciler for AtCounter<'_, D> { type Error = ReconcileError; fn increment(&mut self, by: i64) -> Result<(), Self::Error> { @@ -703,10 +719,12 @@ struct InMap<'a, D> { current_obj: automerge::ObjId, } -impl<'a, D: Doc> MapReconciler for InMap<'a, D> { +impl MapReconciler for InMap<'_, D> { type Error = ReconcileError; - type EntriesIter<'b> = InMapEntries<'b> - where Self: 'b; + type EntriesIter<'b> + = InMapEntries<'b> + where + Self: 'b; fn entries(&self) -> Self::EntriesIter<'_> { InMapEntries { @@ -779,10 +797,12 @@ impl<'a> Iterator for ItemsInSeq<'a> { } } -impl<'a, D: Doc> SeqReconciler for InSeq<'a, D> { +impl SeqReconciler for InSeq<'_, D> { type Error = ReconcileError; - type ItemIter<'b> = ItemsInSeq<'b> - where Self: 'b; + type ItemIter<'b> + = ItemsInSeq<'b> + where + Self: 'b; fn items<'b>(&'_ self) -> Self::ItemIter<'_> { ItemsInSeq { @@ -844,7 +864,7 @@ struct InText<'a, D> { obj: automerge::ObjId, } -impl<'a, D: Doc> TextReconciler for InText<'a, D> { +impl TextReconciler for InText<'_, D> { type Error = ReconcileError; fn splice>( diff --git a/autosurgeon/src/reconcile/impls.rs b/autosurgeon/src/reconcile/impls.rs index 0a805a8..f144d11 100644 --- a/autosurgeon/src/reconcile/impls.rs +++ b/autosurgeon/src/reconcile/impls.rs @@ -56,7 +56,7 @@ impl Reconcile for str { } } -impl<'a, T: Reconcile + ?Sized> Reconcile for &'a T { +impl Reconcile for &'_ T { type Key<'b> = T::Key<'b>; fn reconcile(&self, reconciler: R) -> Result<(), R::Error> { (*self).reconcile(reconciler) @@ -171,6 +171,7 @@ macro_rules! int_impl { Ok(match doc.get(obj, &prop)? { Some((Value::Scalar(s), _)) => { if let ScalarValue::$from(i) = s.as_ref() { + #[allow(irrefutable_let_patterns)] if let Ok(v) = $ty::try_from(*i) { LoadKey::Found(v) } else { diff --git a/autosurgeon/src/reconcile/seq.rs b/autosurgeon/src/reconcile/seq.rs index ffed791..c140ebe 100644 --- a/autosurgeon/src/reconcile/seq.rs +++ b/autosurgeon/src/reconcile/seq.rs @@ -58,7 +58,7 @@ struct Hook<'a, T, S> { items: &'a [T], } -impl<'a, T, S> similar::algorithms::DiffHook for Hook<'a, T, S> +impl similar::algorithms::DiffHook for Hook<'_, T, S> where T: Reconcile, S: SeqReconciler, diff --git a/autosurgeon/src/uuid.rs b/autosurgeon/src/uuid.rs index 3d73a2a..220c25e 100644 --- a/autosurgeon/src/uuid.rs +++ b/autosurgeon/src/uuid.rs @@ -58,7 +58,7 @@ mod tests { let uuid = Uuid::new_v4(); reconcile_prop(&mut doc, ObjId::Root, "secret", uuid).unwrap(); - let hydrated_uuid = hydrate_prop(&doc, ObjId::Root, "secret").unwrap(); + let hydrated_uuid: Uuid = hydrate_prop(&doc, ObjId::Root, "secret").unwrap(); assert_eq!(uuid, hydrated_uuid); } diff --git a/deny.toml b/deny.toml index cebccbb..ece093b 100644 --- a/deny.toml +++ b/deny.toml @@ -11,6 +11,7 @@ # Root options +[graph] # If 1 or more target triples (and optionally, target_features) are specified, # only the specified targets will be checked when running `cargo deny check`. # This means, if a particular package is only ever used as a target specific @@ -46,6 +47,8 @@ no-default-features = false # If set, these feature will be enabled when collecting metadata. If `--features` # is specified on the cmd line they will take precedence over this option. #features = [] + +[output] # When outputting inclusion graphs in diagnostics that include features, this # option can be used to specify the depth at which feature edges will be added. # This option is included since the graphs can be quite large and the addition @@ -61,16 +64,8 @@ feature-depth = 1 db-path = "~/.cargo/advisory-db" # The url(s) of the advisory databases to use db-urls = ["https://github.com/rustsec/advisory-db"] -# The lint level for security vulnerabilities -vulnerability = "deny" -# The lint level for unmaintained crates -unmaintained = "warn" # The lint level for crates that have been yanked from their source registry yanked = "warn" -# The lint level for crates with security notices. Note that as of -# 2019-12-17 there are no security notice advisories in -# https://github.com/rustsec/advisory-db -notice = "warn" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ @@ -96,8 +91,6 @@ ignore = [ # More documentation for the licenses section can be found here: # https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html [licenses] -# The lint level for crates which do not have a detectable license -unlicensed = "deny" # List of explicitly allowed licenses # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. @@ -105,27 +98,9 @@ allow = [ "MIT", "Apache-2.0", "Apache-2.0 WITH LLVM-exception", + "Unicode-3.0", + "MPL-2.0", ] -# List of explicitly disallowed licenses -# See https://spdx.org/licenses/ for list of possible licenses -# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. -deny = [ - #"Nokia", -] -# Lint level for licenses considered copyleft -copyleft = "warn" -# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses -# * both - The license will be approved if it is both OSI-approved *AND* FSF -# * either - The license will be approved if it is either OSI-approved *OR* FSF -# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF -# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved -# * neither - This predicate is ignored and the default lint level is used -allow-osi-fsf-free = "neither" -# Lint level used when no other predicates are matched -# 1. License isn't in the allow or deny lists -# 2. License isn't copyleft -# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither" -default = "deny" # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the # canonical license text of a valid SPDX license file.