Skip to content

Fix code comment inconsistency#139

Open
YichiZhang0613 wants to merge 1 commit intoitsjunetime:mainfrom
YichiZhang0613:fix_inconsistency
Open

Fix code comment inconsistency#139
YichiZhang0613 wants to merge 1 commit intoitsjunetime:mainfrom
YichiZhang0613:fix_inconsistency

Conversation

@YichiZhang0613
Copy link

The comment requires that the following conditions should hold: inclusive_min < exclusive_max and inclusive_min <= around <= exclusive_max, so corresponding assertions should be added.

	/// the following must hold or else this is liable to panic or produce nonsense values:
	/// - inclusive_min < exclusive_max
	/// - inclusive_min <= around <= exclusive_max
	#[must_use]
	pub fn new(around: usize, inclusive_min: usize, exclusive_max: NonZeroUsize) -> Self {		
		Self {
			around,
			inclusive_min,
			exclusive_max,
			next_change: 0,
			next_op: PlusOrMinus::Minus
		}
	}

@YichiZhang0613 YichiZhang0613 changed the title Add assertions Add assertions to fix inconsistency Mar 8, 2026
@YichiZhang0613 YichiZhang0613 changed the title Add assertions to fix inconsistency Fix code comment inconsistency Mar 8, 2026
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.

1 participant