-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
csv: fix equality check for raw records
This commit fixes the equality check for the StringRecord and ByteRecord types such that the field boundaries are respected. That is, [123, 4] should not be equal to [1, 234], but these previously were treated as equivalent. Fixes #138
- Loading branch information
1 parent
3518426
commit efc4a51
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,7 @@ pub struct ByteRecord(Box<ByteRecordInner>); | |
|
||
impl PartialEq for ByteRecord { | ||
fn eq(&self, other: &ByteRecord) -> bool { | ||
self.as_slice() == other.as_slice() | ||
self.iter().zip(other.iter()).all(|e| e.0 == e.1) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
BurntSushi
Owner
|
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is there a problem when the iterators are not equally long?