tools: make v test-cleancode test everything by default (#10050)

This commit is contained in:
Delyan Angelov 2021-05-08 13:32:29 +03:00 committed by GitHub
parent cba2cb6b9c
commit 8a380f4699
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
132 changed files with 3230 additions and 3440 deletions

View file

@ -10,9 +10,9 @@ module subtle
// corresponding) index. The memory beyond the slice length is ignored.
pub fn any_overlap(x []byte, y []byte) bool {
// NOTE: Remember to come back to this (joe-c)
return x.len > 0 && y.len > 0 && // &x.data[0] <= &y.data[y.len-1] &&
return x.len > 0 && y.len > 0 && // &x.data[0] <= &y.data[y.len-1] &&
// &y.data[0] <= &x.data[x.len-1]
unsafe {&x[0] <= &y[y.len - 1] && &y[0] <= &x[x.len - 1]}
unsafe { &x[0] <= &y[y.len - 1] && &y[0] <= &x[x.len - 1] }
}
// inexact_overlap reports whether x and y share memory at any non-corresponding
@ -22,7 +22,7 @@ pub fn any_overlap(x []byte, y []byte) bool {
// inexact_overlap can be used to implement the requirements of the crypto/cipher
// AEAD, Block, BlockMode and Stream interfaces.
pub fn inexact_overlap(x []byte, y []byte) bool {
if x.len == 0 || y.len == 0 || unsafe {&x[0] == &y[0]} {
if x.len == 0 || y.len == 0 || unsafe { &x[0] == &y[0] } {
return false
}
return any_overlap(x, y)