From 0b77fc6bf3bf4c1d0fdb32e324c5db064c639902 Mon Sep 17 00:00:00 2001 From: Der Chien Date: Wed, 28 Dec 2022 22:39:52 +0800 Subject: [PATCH] 20221228 revert the points length check --- src/exercises/day-2/points-polygons.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/exercises/day-2/points-polygons.rs b/src/exercises/day-2/points-polygons.rs index 2f1148c8..0d7c1d23 100644 --- a/src/exercises/day-2/points-polygons.rs +++ b/src/exercises/day-2/points-polygons.rs @@ -84,8 +84,8 @@ impl Polygon { } pub fn length(&self) -> f64 { - if self.points.len() < 3 { - return f64::NAN; + if self.points.is_empty() { + return 0.0; } let mut result = 0.0;