Skip to content

memory-management: rename as_dependency to to_dependency#3173

Merged
gribozavr merged 1 commit into
google:mainfrom
m4tx:to-dependency
Jun 9, 2026
Merged

memory-management: rename as_dependency to to_dependency#3173
gribozavr merged 1 commit into
google:mainfrom
m4tx:to-dependency

Conversation

@m4tx

@m4tx m4tx commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Because this function takes a reference to self and returns an owned object, it's more idiomatic to call it to_ rather than as_: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv

This was brought up when discussing the code with the students when running the course.

Because this function takes a reference to `self` and returns an owned
object, it's more idiomatic to call it `to_` rather than `as_`:
https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv

This was brought up when discussing the code with the students when
running the course.

@mgeisler mgeisler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, that makes sense to me!

@gribozavr gribozavr merged commit deb6224 into google:main Jun 9, 2026
37 checks passed
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