Skip to content

Fix len bug#471

Merged
SmartMonkey-git merged 3 commits into
mainfrom
rr/fix-get-medical-action
Mar 25, 2026
Merged

Fix len bug#471
SmartMonkey-git merged 3 commits into
mainfrom
rr/fix-get-medical-action

Conversation

@SmartMonkey-git

Copy link
Copy Markdown
Collaborator

No description provided.

@psnairne psnairne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@SmartMonkey-git

Copy link
Copy Markdown
Collaborator Author

I made the state unrepresentable by returning an option on MedicalData::new()

#[doc(hidden)]
fn construct_data_unchecked(&self, idx: usize) -> Result<Option<Self::Item<'_>>, GetterError>;
fn len(&self) -> usize;
fn is_empty(&self) -> bool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is now never used. Was it left over from a previous solution?

@SmartMonkey-git
SmartMonkey-git merged commit c470abe into main Mar 25, 2026
4 checks passed
@SmartMonkey-git
SmartMonkey-git deleted the rr/fix-get-medical-action branch March 25, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants