Skip to content

Commit

Permalink
Elide lifetimes in impls where possible
Browse files Browse the repository at this point in the history
Resolve `clippy::needless_lifetimes` lint warnings.
  • Loading branch information
robertknight committed Dec 15, 2024
1 parent 755b313 commit 8b176f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ocrs-cli/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub enum ModelSource<'a> {
Path(&'a str),
}

impl<'a> fmt::Display for ModelSource<'a> {
impl fmt::Display for ModelSource<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
Expand Down
2 changes: 1 addition & 1 deletion ocrs/src/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<'a> From<NdTensorView<'a, u8, 3>> for ImagePixels<'a> {
}
}

impl<'a> ImagePixels<'a> {
impl ImagePixels<'_> {
fn shape(&self) -> [usize; 3] {
match self {
ImagePixels::Floats(f) => f.shape(),
Expand Down
6 changes: 3 additions & 3 deletions ocrs/src/text_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ pub struct TextWord<'a> {
}

impl<'a> TextWord<'a> {
fn new(chars: &'a [TextChar]) -> TextWord {
fn new(chars: &'a [TextChar]) -> TextWord<'a> {
assert!(!chars.is_empty(), "Text words must not be empty");
TextWord { chars }
}
}

impl<'a> TextItem for TextWord<'a> {
impl TextItem for TextWord<'_> {
fn chars(&self) -> &[TextChar] {
self.chars
}
}

impl<'a> fmt::Display for TextWord<'a> {
impl fmt::Display for TextWord<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt_text_item(self, f)
}
Expand Down

0 comments on commit 8b176f4

Please sign in to comment.