Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy lints suggested by nightly 1.74 #249

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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"),
Expand Down
22 changes: 3 additions & 19 deletions src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/internal_rep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, String>) -> 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 {
Expand Down