Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_subnet_of fix #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ipv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

/// Checks if the given `Ipv4Network` is a subnet of the other.
pub fn is_subnet_of(self, other: Ipv4Network) -> bool {
other.ip() <= self.ip() && other.broadcast() >= self.broadcast()
other.network() <= self.network() && other.broadcast() >= self.broadcast()
}

/// Checks if the given `Ipv4Network` is a supernet of the other.
Expand Down Expand Up @@ -446,7 +446,7 @@
let ip = Ipv4Addr::new(10, 1, 0, 1);
assert!(!cidr.contains(ip));
}

Check warning on line 449 in src/ipv4.rs

View workflow job for this annotation

GitHub Actions / build (beta)

calls to `std::mem::drop` with a value that implements `Copy` does nothing

Check warning on line 449 in src/ipv4.rs

View workflow job for this annotation

GitHub Actions / build (nightly)

calls to `std::mem::drop` with a value that implements `Copy` does nothing
#[test]
fn iterator_v4() {
let cidr: Ipv4Network = "192.168.122.0/30".parse().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl Ipv6Network {

/// Checks if the given `Ipv6Network` is a subnet of the other.
pub fn is_subnet_of(self, other: Ipv6Network) -> bool {
other.ip() <= self.ip() && other.broadcast() >= self.broadcast()
other.network() <= self.network() && other.broadcast() >= self.broadcast()
}

/// Checks if the given `Ipv6Network` is a supernet of the other.
Expand Down