Skip to content

Commit 2d2a1fb

Browse files
committed
Apply suggestions
1 parent cf17597 commit 2d2a1fb

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

src/numeral_systems.rs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Various ways of displaying non-negative integers.
22
3-
use chinese_number::{ChineseCase, ChineseVariant, from_u64_to_chinese_ten_thousand};
43
use std::fmt::{Display, Formatter};
54

5+
use chinese_number::{ChineseCase, ChineseVariant, from_u64_to_chinese_ten_thousand};
6+
67
macro_rules! declare_named {
78
(
89
$( #[$attr:meta] )*
@@ -932,7 +933,8 @@ pub enum NumeralSystem<'a> {
932933
///
933934
/// ## Representable Numbers
934935
///
935-
/// A numeral system of this kind can represent any non-negative integer.
936+
/// A numeral system of this kind with `n` symbols can represent any
937+
/// non-negative integer up to `n - 1`.
936938
///
937939
/// ## Example
938940
///
@@ -951,7 +953,8 @@ pub enum NumeralSystem<'a> {
951953
///
952954
/// ## Representable Numbers
953955
///
954-
/// A numeral system of this kind can represent any positive integer.
956+
/// A numeral system of this kind with `n` symbols can represent any
957+
/// positive integer up to `n`.
955958
///
956959
/// ## Example
957960
///
@@ -997,7 +1000,7 @@ impl<'a> NumeralSystem<'a> {
9971000
pub const fn represent(
9981001
self,
9991002
number: u64,
1000-
) -> Result<RepresentedNumber<'a>, RepresentationError> {
1003+
) -> Result<impl Display, RepresentationError> {
10011004
match self {
10021005
Self::Positional(_) | Self::Chinese(_, _) => {}
10031006
Self::Bijective(_) | Self::Symbolic(_) => {
@@ -1234,7 +1237,7 @@ mod tests {
12341237
.to_string(),
12351238
format!("{c1}").to_uppercase(),
12361239
);
1237-
n += 1
1240+
n += 1;
12381241
}
12391242
for c2 in 'a'..='z' {
12401243
for c1 in 'a'..='z' {
@@ -1254,7 +1257,7 @@ mod tests {
12541257
.to_string(),
12551258
format!("{c2}{c1}").to_uppercase(),
12561259
);
1257-
n += 1
1260+
n += 1;
12581261
}
12591262
}
12601263
for c3 in 'a'..='z' {
@@ -1276,7 +1279,7 @@ mod tests {
12761279
.to_string(),
12771280
format!("{c3}{c2}{c1}").to_uppercase(),
12781281
);
1279-
n += 1
1282+
n += 1;
12801283
}
12811284
}
12821285
}
@@ -1329,24 +1332,4 @@ mod tests {
13291332
)
13301333
}
13311334
}
1332-
1333-
// #[test]
1334-
// fn foo() {
1335-
// let mut values = String::new();
1336-
// for i in 0..12 {
1337-
// if i != 0 {
1338-
// values.push_str(", ")
1339-
// }
1340-
// // values.push_str("<span dir=\"auto\">");
1341-
// values.push_str(
1342-
// &NamedNumeralSystem::BengaliLetters
1343-
// .system()
1344-
// .represent(i + 1)
1345-
// .unwrap()
1346-
// .to_string(),
1347-
// );
1348-
// // values.push_str("</span>");
1349-
// }
1350-
// panic!("{values}")
1351-
// }
13521335
}

0 commit comments

Comments
 (0)