Repository: nushell/nushell
File: crates/nu-protocol/src/value/range.rs (Rust)

Code before:
            self.end
        }

        pub fn step(&self) -> i64 {
            self.step
        }

        pub fn is_unbounded(&self) -> bool {
            self.end == Bound::Unbounded
        }

        pub fn contains(&self, value: i64) -> bool {
            if self.step < 0 {
                // Decreasing range
                if value > self.start {
                    return false;
                }
                match self.end {
                    Bound::Included(end) if value < end => return false,
                    Bound::Excluded(end) if value <= end => return false,
                    _ => {}
                };
            } else {
                // Increasing range
                if value < self.start {
                    dbg!(value, self.start, value > self.start);
                    return false;
                }
                match self.end {
                    Bound::Included(end) if value > end => return false,
                    Bound::Excluded(end) if value >= end => return false,
                    _ => {}
                };
            }
            (value - self.start) % self.step == 0
        }

        pub fn into_range_iter(self, signals: Signals) -> Iter {
            Iter {
                current: Some(self.start),
                step: self.step,
                end: self.end,
                signals,
            }
        }
    }

    impl Ord for IntRange {
        fn cmp(&self, other: &Self) -> Ordering {
            // Ranges are compared roughly according to their list representation.
            // Compare in order:

Review comment (refactor):
i think you should probably remove this `dbg!()`
```suggestion

```

Code after:
            self.end
        }

        pub fn step(&self) -> i64 {
            self.step
        }

        pub fn is_unbounded(&self) -> bool {
            self.end == Bound::Unbounded
        }

        pub fn contains(&self, value: i64) -> bool {
            if self.step < 0 {
                // Decreasing range
                if value > self.start {
                    return false;
                }
                match self.end {
                    Bound::Included(end) if value < end => return false,
                    Bound::Excluded(end) if value <= end => return false,
                    _ => {}
                };
            } else {
                // Increasing range
                if value < self.start {
                    return false;
                }
                match self.end {
                    Bound::Included(end) if value > end => return false,
                    Bound::Excluded(end) if value >= end => return false,
                    _ => {}
                };
            }
            (value - self.start) % self.step == 0
        }

        pub fn into_range_iter(self, signals: Signals) -> Iter {
            Iter {
                current: Some(self.start),
                step: self.step,
                end: self.end,
                signals,
            }
        }
    }

    impl Ord for IntRange {
        fn cmp(&self, other: &Self) -> Ordering {
            // Ranges are compared roughly according to their list representation.
            // Compare in order:
            // - the head element (start)