use pointer args

This commit is contained in:
Daniel Eades 2022-12-30 08:25:39 +00:00
parent ed128872eb
commit 7530d76f00
3 changed files with 3 additions and 3 deletions

View file

@ -514,7 +514,7 @@ fn fn_args(
/// vec!["foo_1".into(), "foo_2".into(), "bar_1".into(), "baz".into(), "bar_2".into()];
/// assert_eq!(names, expected);
/// ```
fn deduplicate_arg_names(arg_names: &mut Vec<String>) {
fn deduplicate_arg_names(arg_names: &mut [String]) {
let mut arg_name_counts = FxHashMap::default();
for name in arg_names.iter() {
*arg_name_counts.entry(name).or_insert(0) += 1;

View file

@ -419,7 +419,7 @@ fn gen_partial_eq(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
make::ext::path_from_idents(["Self", &variant.name()?.to_string()])
}
fn gen_tuple_field(field_name: &String) -> ast::Pat {
fn gen_tuple_field(field_name: &str) -> ast::Pat {
ast::Pat::IdentPat(make::ident_pat(false, false, make::name(field_name)))
}

View file

@ -100,7 +100,7 @@ impl Round {
self.linear = rmse < 0.05 && max_error < 0.1 && a > -0.1;
fn normalize(xs: &mut Vec<f64>) {
fn normalize(xs: &mut [f64]) {
let max = xs.iter().copied().max_by(|a, b| a.partial_cmp(b).unwrap()).unwrap();
xs.iter_mut().for_each(|it| *it /= max);
}