Skip to content

Commit

Permalink
use const fn for inner and is_empty
Browse files Browse the repository at this point in the history
Signed-off-by: guoweikang <[email protected]>
  • Loading branch information
guoweikang committed Oct 18, 2024
1 parent deaebf9 commit 5d853ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ macro_rules! def_node {

#[inline]
#[doc = "Get inner"]
pub fn inner(&self) -> &$type {
pub const fn inner(&self) -> &$type {
&self.inner
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ macro_rules! def_generic_node {

#[inline]
#[doc = "Get inner"]
pub fn inner(&self) -> &T {
pub const fn inner(&self) -> &T {
&self.inner
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl<G: GetLinksWrapped> List<G> {
}

/// Returns whether the list is empty.
pub fn is_empty(&self) -> bool {
pub const fn is_empty(&self) -> bool {
self.list.is_empty()
}

Expand Down
2 changes: 1 addition & 1 deletion src/raw_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<G: GetLinks> RawList<G> {
Iterator::new(self.cursor_front(), self.cursor_back())
}

pub(crate) fn is_empty(&self) -> bool {
pub(crate) const fn is_empty(&self) -> bool {
self.head.is_none()
}

Expand Down

0 comments on commit 5d853ff

Please sign in to comment.