[#1] weave::attempt was removed in favor of ?.

The old try macro style fell out of favour a long time ago. As such
it is time to bring this code forward to the new style. It was just
doing the same thing in the macro call anyways.
This commit is contained in:
Myrddin Dundragon 2025-03-10 11:48:53 -04:00
parent c3f2bb7a23
commit f38f21fe84

View File

@ -5,8 +5,6 @@ use std::fmt::{Error, Formatter, Debug, Display};
use std::ops::{Add, Sub, Mul, Div, Rem, Neg}; use std::ops::{Add, Sub, Mul, Div, Rem, Neg};
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
use weave::attempt;
use crate::zero::Zero; use crate::zero::Zero;
use crate::one::One; use crate::one::One;
use crate::number::Number; use crate::number::Number;
@ -550,12 +548,12 @@ macro_rules! define_vector
// pretty up the printing. // pretty up the printing.
count = self.get_size(); count = self.get_size();
attempt!(write!(formatter, "<")); write!(formatter, "<")?;
$( $(
attempt!(write!(formatter, "{:?}", self.$field)); write!(formatter, "{:?}", self.$field)?;
if count > 0 if count > 0
{ {
attempt!(write!(formatter, ", ")); write!(formatter, ", ")?;
} }
count -= 1; count -= 1;
)* )*
@ -575,12 +573,12 @@ macro_rules! define_vector
// pretty up the printing. // pretty up the printing.
count = self.get_size(); count = self.get_size();
attempt!(write!(formatter, "<")); write!(formatter, "<")?;
$( $(
attempt!(write!(formatter, "{}", self.$field)); write!(formatter, "{}", self.$field)?;
if count > 1 if count > 1
{ {
attempt!(write!(formatter, ", ")); write!(formatter, ", ")?;
} }
count -= 1; count -= 1;
)* )*