Fix len bug#471
Merged
Merged
Conversation
psnairne
reviewed
Mar 25, 2026
psnairne
left a comment
Contributor
There was a problem hiding this comment.
Hmm this seems like a counter-intuitive solution to me.
let medical_action_data = match self.medical_action_data.get(self.current_index) {
Ok(mad) => mad,
Err(err) => return Some(Err(CollectorError::from(err))),
};
I would have suggested that at this point, in the code, we do a check to make sure the MAD is not empty.
To do that, I would implement a .is_empty/ '.is_some()' on MAD, where is_empty is true if all the Options are None
Collaborator
Author
|
I made the state unrepresentable by returning an option on MedicalData::new() |
psnairne
approved these changes
Mar 25, 2026
| #[doc(hidden)] | ||
| fn construct_data_unchecked(&self, idx: usize) -> Result<Option<Self::Item<'_>>, GetterError>; | ||
| fn len(&self) -> usize; | ||
| fn is_empty(&self) -> bool { |
Contributor
There was a problem hiding this comment.
this is now never used. Was it left over from a previous solution?
SmartMonkey-git
enabled auto-merge
March 25, 2026 13:48
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.