Remove assertions for what we know works well

This commit is contained in:
Roderick van Domburg 2022-01-25 20:58:39 +01:00
parent 552d9145f4
commit 44860f4738
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
5 changed files with 1 additions and 6 deletions

View file

@ -229,7 +229,6 @@ impl RangeSet {
self.ranges[self_index].end(),
other.ranges[other_index].end(),
);
assert!(new_start <= new_end);
result.add_range(&Range::new(new_start, new_end - new_start));
if self.ranges[self_index].end() <= other.ranges[other_index].end() {
self_index += 1;

View file

@ -1059,7 +1059,6 @@ impl SpircTask {
fn handle_unavailable(&mut self, track_id: SpotifyId) {
let unavailables = self.get_track_index_for_spotify_id(&track_id, 0);
for &index in unavailables.iter() {
debug_assert_eq!(self.state.get_track()[index].get_gid(), track_id.to_raw());
let mut unplayable_track_ref = TrackRef::new();
unplayable_track_ref.set_gid(self.state.get_track()[index].get_gid().to_vec());
// Misuse context field to flag the track
@ -1320,8 +1319,6 @@ impl SpircTask {
.filter(|&(_, track_ref)| track_ref.get_gid() == track_id.to_raw())
.map(|(idx, _)| start_index + idx)
.collect();
// Sanity check
debug_assert!(!index.is_empty());
index
}

View file

@ -114,7 +114,6 @@ impl Credentials {
let cipher = Aes192::new(GenericArray::from_slice(&key));
let block_size = <Aes192 as BlockCipher>::BlockSize::to_usize();
assert_eq!(data.len() % block_size, 0);
for chunk in data.chunks_exact_mut(block_size) {
cipher.decrypt_block(GenericArray::from_mut_slice(chunk));
}

View file

@ -173,7 +173,6 @@ impl Stream for Channel {
let length = BigEndian::read_u16(data.split_to(2).as_ref()) as usize;
if length == 0 {
assert_eq!(data.len(), 0);
self.state = ChannelState::Data;
} else {
let header_id = data.split_to(1).as_ref()[0];

View file

@ -165,6 +165,7 @@ fn split_uri(s: &str) -> Option<impl Iterator<Item = &'_ str>> {
let rest = rest.trim_end_matches(sep);
let mut split = rest.split(sep);
#[cfg(debug_assertions)]
if rest.is_empty() {
assert_eq!(split.next(), Some(""));
}