Skip to content

Commit fa50056

Browse files
Apply suggestions from code review
Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
1 parent 3739372 commit fa50056

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

stdlib/src/math.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ mod math {
331331
};
332332
let mut norm = v
333333
.iter()
334-
.cloned()
334+
.copied()
335335
.map(|x| x / scale)
336336
.reduce(accurate_hypot)
337337
.unwrap_or_default();
@@ -342,9 +342,8 @@ mod math {
342342
// approximation of the square root of that to `norm`.
343343
let correction = v
344344
.iter()
345-
.cloned()
346-
.map(|x| x / scale)
347-
.map(|x| x * x)
345+
.copied()
346+
.map(|x| (x / scale).pow(2))
348347
.chain(std::iter::once(-norm * norm))
349348
.tree_fold1(std::ops::Add::add)
350349
.unwrap();

0 commit comments

Comments
 (0)