-
Couldn't load subscription status.
- Fork 13.9k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
I've been told that parameter names are not part of the API, so this might not matter at all (except to pedantic people like me):
I've found 17 functions with the name with_capacity(): https://doc.rust-lang.org/stable/std/index.html?search=with_capacity
Most of them use capacity as parameter name:
- https://doc.rust-lang.org/alloc/vec/struct.Vec.html#method.with_capacity
- https://doc.rust-lang.org/std/vec/struct.Vec.html#method.with_capacity
- https://doc.rust-lang.org/alloc/string/struct.String.html#method.with_capacity
- https://doc.rust-lang.org/std/string/struct.String.html#method.with_capacity
- https://doc.rust-lang.org/alloc/collections/binary_heap/struct.BinaryHeap.html#method.with_capacity
- https://doc.rust-lang.org/std/collections/binary_heap/struct.BinaryHeap.html#method.with_capacity
- https://doc.rust-lang.org/std/collections/struct.HashSet.html#method.with_capacity
- https://doc.rust-lang.org/std/collections/struct.HashSet.html#method.with_capacity_and_hasher
- https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.with_capacity
- https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.with_capacity_and_hasher
- https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.with_capacity
- https://doc.rust-lang.org/std/ffi/struct.OsString.html#method.with_capacity
Some functions, however, use cap as argument name:
- https://doc.rust-lang.org/std/io/struct.LineWriter.html#method.with_capacity
- https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.with_capacity
- https://doc.rust-lang.org/std/io/struct.BufReader.html#method.with_capacity
Others are using n:
- https://doc.rust-lang.org/alloc/collections/vec_deque/struct.VecDeque.html#method.with_capacity
- https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#method.with_capacity
Wouldn't it make sense to call all of them capacity?
Does anyone care about such things?
If yes, we could play the same game with swap() and probably with other common functions.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.