Expand note about arrays and slices.
This commit is contained in:
parent
a30533becf
commit
981b355617
5
STYLE.md
5
STYLE.md
@ -22,12 +22,15 @@ Use the early-return-on-failure pattern by wrapping calls to functions that may
|
||||
fail with `try!()`. Do not use `Result::or_else`, `Result::and`, etc. to chain
|
||||
together strings of potentially-failing operations.
|
||||
|
||||
## Arrays
|
||||
## Arrays and Slices
|
||||
|
||||
When creating a slice from the start of a indexable value, use `x[..n]`, not
|
||||
`x[0..n]`. Similarly, use `x[n..]`, not `x[n..x.len()]` for creating a slice
|
||||
from a specific point to the end of the value.
|
||||
|
||||
When copying and filling arrays and slices, use the functions in
|
||||
[ring::polyfill](src/polyfill.rs) when possible.
|
||||
|
||||
## Casting (`as`) and Conversions
|
||||
|
||||
Avoid using the `as` operator. When using `as` seems necessary, see if there is
|
||||
|
Loading…
x
Reference in New Issue
Block a user