Skip to content

Refactor: Use borrowed types for arguments#269

Merged
adpaco-aws merged 2 commits intomodel-checking:main-153-2021-06-23from
danielsn:idiomatic-rust
Jun 29, 2021
Merged

Refactor: Use borrowed types for arguments#269
adpaco-aws merged 2 commits intomodel-checking:main-153-2021-06-23from
danielsn:idiomatic-rust

Conversation

@danielsn
Copy link
Contributor

@danielsn danielsn commented Jun 28, 2021

Description of changes:

As per https://rust-unofficial.github.io/patterns/idioms/coercion-arguments.html#use-borrowed-types-for-arguments we should prefer &[T] to &Vec<T> for function arguments. Doing so

Resolved issues:

Initial step on #270

Call-outs:

Testing:

  • How is this change tested? Existing tests

  • Is this a refactor change? Yes

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@avanhatt avanhatt requested review from avanhatt and removed request for avanhatt June 28, 2021 20:14
Copy link
Contributor

@avanhatt avanhatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@avanhatt
Copy link
Contributor

Actually, should we be doing this change for &mut Vec<T> args too?

@danielsn
Copy link
Contributor Author

Actually, should we be doing this change for &mut Vec<T> args too?

220 |                         fargs.push(index_param);
    |                               ^^^^ method not found in `&mut [expr::Expr]`

@adpaco-aws adpaco-aws merged commit c99c2fb into model-checking:main-153-2021-06-23 Jun 29, 2021
adpaco-aws added a commit that referenced this pull request Jul 2, 2021
adpaco-aws added a commit that referenced this pull request Jul 9, 2021
adpaco-aws added a commit that referenced this pull request Jul 15, 2021
adpaco-aws added a commit that referenced this pull request Jul 26, 2021
adpaco-aws added a commit that referenced this pull request Aug 2, 2021
@zhassan-aws zhassan-aws mentioned this pull request Aug 6, 2021
4 tasks
adpaco-aws added a commit that referenced this pull request Aug 6, 2021
adpaco-aws added a commit that referenced this pull request Aug 17, 2021
adpaco-aws added a commit that referenced this pull request Aug 24, 2021
@danielsn danielsn deleted the idiomatic-rust branch September 24, 2021 21:33
tedinski pushed a commit to tedinski/rmc that referenced this pull request Apr 26, 2022
tedinski pushed a commit that referenced this pull request Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants