mirror of
https://github.com/hannobraun/Fornjot
synced 2025-06-14 15:28:56 +00:00
use built-in 'assert'
This commit is contained in:
parent
392a2d34ef
commit
844185baf5
@ -46,9 +46,10 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We know that `self != other`, or we wouldn't have made it here.
|
// We know that `self != other`, or we wouldn't have made it here.
|
||||||
if self.is_some() && other.is_some() {
|
assert!(
|
||||||
panic!("Can't merge two `Option`s that are both `Some`")
|
self.is_none() || other.is_none(),
|
||||||
}
|
"Can't merge two `Option`s that are both `Some`"
|
||||||
|
);
|
||||||
|
|
||||||
self.xor(other)
|
self.xor(other)
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,7 @@ impl<T> Block<T> {
|
|||||||
pub fn insert(&mut self, index: ObjectIndex, object: T) {
|
pub fn insert(&mut self, index: ObjectIndex, object: T) {
|
||||||
let slot = &mut self.objects[index.0];
|
let slot = &mut self.objects[index.0];
|
||||||
|
|
||||||
if slot.is_some() {
|
assert!(slot.is_none(), "Attempting to overwrite object in store");
|
||||||
panic!("Attempting to overwrite object in store")
|
|
||||||
}
|
|
||||||
|
|
||||||
*slot = Some(object);
|
*slot = Some(object);
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,10 @@ impl<const D: usize> Line<D> {
|
|||||||
origin: Point<D>,
|
origin: Point<D>,
|
||||||
direction: Vector<D>,
|
direction: Vector<D>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
if direction.magnitude() == Scalar::ZERO {
|
assert!(
|
||||||
panic!("Can't construct `Line`. Direction is zero: {direction:?}");
|
direction.magnitude() != Scalar::ZERO,
|
||||||
}
|
"Can't construct `Line`. Direction is zero: {direction:?}"
|
||||||
|
);
|
||||||
|
|
||||||
Self { origin, direction }
|
Self { origin, direction }
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,10 @@ impl EventLoopHandler {
|
|||||||
let event = events
|
let event = events
|
||||||
.try_recv()
|
.try_recv()
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if err.is_disconnected() {
|
assert!(
|
||||||
panic!("Expected channel to never disconnect");
|
!err.is_disconnected(),
|
||||||
}
|
"Expected channel to never disconnect"
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ pub fn find_version_in_str(s: &str) -> anyhow::Result<Option<semver::Version>> {
|
|||||||
version.as_str(),
|
version.as_str(),
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.filter_map(|m| {
|
.find_map(|m| {
|
||||||
let version = semver::Version::parse(m.as_str()).ok();
|
let version = semver::Version::parse(m.as_str()).ok();
|
||||||
|
|
||||||
if version.is_some() {
|
if version.is_some() {
|
||||||
@ -19,8 +19,7 @@ pub fn find_version_in_str(s: &str) -> anyhow::Result<Option<semver::Version>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
version
|
version
|
||||||
})
|
});
|
||||||
.next();
|
|
||||||
|
|
||||||
Ok(version)
|
Ok(version)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user