From 3eb4e76ab2bb3883a5bb9775cee608dead8260bc Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 21 Jan 2025 12:59:34 -0800
Subject: [PATCH] replace `.map_or(None,` with `.and_then(`

---
 strafe-client/src/model_physics.rs | 6 +++---
 strafe-client/src/physics.rs       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/strafe-client/src/model_physics.rs b/strafe-client/src/model_physics.rs
index 9aa0d716..7601058c 100644
--- a/strafe-client/src/model_physics.rs
+++ b/strafe-client/src/model_physics.rs
@@ -720,7 +720,7 @@ impl MinkowskiMesh<'_>{
 	// Most of the calculation time is just calculating the starting point
 	// for the "actual" crawling algorithm below (predict_collision_{in|out}).
 	fn closest_fev_not_inside(&self,mut infinity_body:Body,start_time:Time)->Option<FEV<MinkowskiMesh>>{
-		infinity_body.infinity_dir().map_or(None,|dir|{
+		infinity_body.infinity_dir().and_then(|dir|{
 			let infinity_fev=self.infinity_fev(-dir,infinity_body.position);
 			//a line is simpler to solve than a parabola
 			infinity_body.velocity=dir;
@@ -731,7 +731,7 @@ impl MinkowskiMesh<'_>{
 		})
 	}
 	pub fn predict_collision_in(&self,relative_body:&Body,Range{start:start_time,end:time_limit}:Range<Time>)->Option<(MinkowskiFace,GigaTime)>{
-		self.closest_fev_not_inside(relative_body.clone(),start_time).map_or(None,|fev|{
+		self.closest_fev_not_inside(relative_body.clone(),start_time).and_then(|fev|{
 			//continue forwards along the body parabola
 			fev.crawl(self,relative_body,start_time,time_limit).hit()
 		})
@@ -739,7 +739,7 @@ impl MinkowskiMesh<'_>{
 	pub fn predict_collision_out(&self,relative_body:&Body,Range{start:start_time,end:time_limit}:Range<Time>)->Option<(MinkowskiFace,GigaTime)>{
 		//create an extrapolated body at time_limit
 		let infinity_body=-relative_body.clone();
-		self.closest_fev_not_inside(infinity_body,-time_limit).map_or(None,|fev|{
+		self.closest_fev_not_inside(infinity_body,-time_limit).and_then(|fev|{
 			//continue backwards along the body parabola
 			fev.crawl(self,&infinity_body,-time_limit,-start_time).hit()
 				//no need to test -time<time_limit because of the first step
diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs
index 1ce44121..5b7cab27 100644
--- a/strafe-client/src/physics.rs
+++ b/strafe-client/src/physics.rs
@@ -1187,7 +1187,7 @@ impl PhysicsData{
 			let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,data.hitbox_mesh.transformed_mesh());
 			collector.collect(minkowski.predict_collision_in(relative_body,state.time..collector.time())
 				//temp (?) code to avoid collision loops
-				.map_or(None,|(face,dt)|{
+				.and_then(|(face,dt)|{
 					// this must be rounded to avoid the infinite loop when hitting the start zone
 					let time=relative_body.time+dt.into();
 					(state.time<time).then_some((time,face,dt))