diff --git a/src/compile.rs b/src/compile.rs index f5684584..2019623d 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -136,7 +136,7 @@ fn map_annotation_info( return false; } }; - let annotations = annotation_map.entry(key).or_insert_with(BTreeSet::new); + let annotations = annotation_map.entry(key).or_default(); if !annotation_infos.is_empty() { annotations.append(&mut annotation_infos); } diff --git a/src/context.rs b/src/context.rs index f32899e3..0c8250e0 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: MIT -use std::borrow::Borrow; use std::collections::BTreeMap; use std::iter; use std::ops::Range; @@ -96,7 +95,7 @@ impl<'a> Context<'a> { let arg = self.convert_arg_this(arg); match self.symbols.get(&CascadeString::from(&arg as &str)) { Some(b) => match b { - BindableObject::Type(t) => Some(t.type_info.borrow()), + BindableObject::Type(t) => Some(t.type_info), // TypeList isn't natural to implement with the current API BindableObject::TypeList(_) => todo!(), BindableObject::PermList(_) => type_map.get("perm"), diff --git a/src/functions.rs b/src/functions.rs index 43772c9e..acf3e96f 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT use sexp::{atom_s, list, Atom, Sexp}; -use std::borrow::{Borrow, Cow}; +use std::borrow::Cow; use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet}; use std::convert::TryFrom; @@ -3416,28 +3416,12 @@ impl<'a> ArgForValidation<'a> { match self { ArgForValidation::Var(s) => { - validate_cast( - s, - Some(cast_ti.type_info.borrow()), - None, - None, - types, - context, - file, - )?; + validate_cast(s, Some(cast_ti.type_info), None, None, types, context, file)?; } ArgForValidation::List(v) => { for s in v { // TODO: report more than just the first error - validate_cast( - s, - Some(cast_ti.type_info.borrow()), - None, - None, - types, - context, - file, - )?; + validate_cast(s, Some(cast_ti.type_info), None, None, types, context, file)?; } } ArgForValidation::Quote(inner) => { diff --git a/src/internal_rep.rs b/src/internal_rep.rs index 7efb160b..1f769156 100644 --- a/src/internal_rep.rs +++ b/src/internal_rep.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MIT use sexp::{atom_s, list, Sexp}; -use std::borrow::{Borrow, Cow}; +use std::borrow::Cow; use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet}; use std::convert::TryFrom; @@ -938,7 +938,7 @@ impl<'a> Context<'a> { // The global rename_cow works on CascadeStrings. In this local case we work on &strs // instead fn rename_cow<'a>(cow_str: &str, renames: &BTreeMap) -> Cow<'a, str> { - let new_str: &str = cow_str.borrow(); + let new_str: &str = cow_str; Cow::Owned(renames.get(new_str).unwrap_or(&new_str.to_string()).clone()) } Context {