Skip to content

Commit da737dc

Browse files
authored
Merge pull request #258 from guanqun/polish-index-struct-macro
polish the index_struct macro implementation
2 parents 1a9b079 + 8f4ec64 commit da737dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chalk-macros/src/index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ macro_rules! index_struct {
1515
#[allow(dead_code)]
1616
$v fn get_and_increment(&mut self) -> Self {
1717
let old_value = *self;
18-
self.value += 1;
18+
self.increment();
1919
old_value
2020
}
2121

@@ -31,14 +31,14 @@ macro_rules! index_struct {
3131
}
3232

3333
impl ::std::fmt::Debug for $n {
34-
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
34+
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
3535
write!(fmt, "{}({})", stringify!($n), self.value)
3636
}
3737
}
3838

3939
impl From<usize> for $n {
4040
fn from(value: usize) -> Self {
41-
Self { value: value }
41+
Self { value }
4242
}
4343
}
4444
}

0 commit comments

Comments
 (0)