Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clippy): apply needless_lifetimes clippy fix #848

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions topiary-cli/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub struct InputFile<'cfg> {
query: QuerySource,
}

impl<'cfg> InputFile<'cfg> {
impl InputFile<'_> {
/// Convert our `InputFile` into language definition values that Topiary can consume
pub async fn to_language(&self) -> CLIResult<Language> {
let grammar = self.language().grammar()?;
Expand Down Expand Up @@ -149,7 +149,7 @@ impl<'cfg> InputFile<'cfg> {
}
}

impl<'cfg> Read for InputFile<'cfg> {
impl Read for InputFile<'_> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
match &mut self.source {
InputSource::Stdin => stdin().lock().read(buf),
Expand Down Expand Up @@ -312,7 +312,7 @@ impl Write for OutputFile {
// Convenience conversion:
// * stdin maps to stdout
// * Files map to themselves (i.e., for in-place updates)
impl<'cfg> TryFrom<&InputFile<'cfg>> for OutputFile {
impl TryFrom<&InputFile<'_>> for OutputFile {
type Error = TopiaryError;

fn try_from(input: &InputFile) -> CLIResult<Self> {
Expand Down
2 changes: 1 addition & 1 deletion topiary-core/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async fn format() {

let language: Language = Language {
name: "ocaml".to_owned(),
query: TopiaryQuery::new(&ocaml.clone().into(), &query_content).unwrap(),
query: TopiaryQuery::new(&ocaml.into(), &query_content).unwrap(),
grammar: ocaml.into(),
indent: None,
};
Expand Down
6 changes: 3 additions & 3 deletions topiary-core/src/tree_sitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub trait NodeExt {
fn display_one_based(&self) -> String;
}

impl<'a> NodeExt for Node<'a> {
impl NodeExt for Node<'_> {
fn display_one_based(&self) -> String {
format!(
"{{Node {:?} {} - {}}}",
Expand All @@ -166,7 +166,7 @@ impl<'a> NodeExt for Node<'a> {
}

#[cfg(not(target_arch = "wasm32"))]
impl<'a> NodeExt for tree_sitter::Node<'a> {
impl NodeExt for tree_sitter::Node<'_> {
fn display_one_based(&self) -> String {
format!(
"{{Node {:?} {} - {}}}",
Expand All @@ -189,7 +189,7 @@ struct LocalQueryMatch<'a> {
captures: Vec<QueryCapture<'a>>,
}

impl<'a> Display for LocalQueryMatch<'a> {
impl Display for LocalQueryMatch<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
Expand Down
2 changes: 1 addition & 1 deletion topiary-tree-sitter-facade/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod native {
pub(crate) inner: tree_sitter::LanguageRef<'a>,
}

impl<'a> LanguageRef<'a> {
impl LanguageRef<'_> {
pub fn field_count(&self) -> usize {
self.inner.field_count()
}
Expand Down
10 changes: 5 additions & 5 deletions topiary-tree-sitter-facade/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ mod native {
}
}

impl<'tree> std::fmt::Debug for Node<'tree> {
impl std::fmt::Debug for Node<'_> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Debug::fmt(&self.inner, fmt)
}
Expand All @@ -256,7 +256,7 @@ mod native {
}
}

impl<'a> Ord for Node<'a> {
impl Ord for Node<'_> {
fn cmp(&self, that: &Self) -> std::cmp::Ordering {
let this = self.id();
let that = that.id();
Expand All @@ -270,11 +270,11 @@ mod native {
}
}

impl<'a> std::panic::RefUnwindSafe for Node<'a> {}
impl std::panic::RefUnwindSafe for Node<'_> {}

impl<'a> Unpin for Node<'a> {}
impl Unpin for Node<'_> {}

impl<'a> std::panic::UnwindSafe for Node<'a> {}
impl std::panic::UnwindSafe for Node<'_> {}
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down
10 changes: 5 additions & 5 deletions topiary-tree-sitter-facade/src/query_capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod native {
pub(crate) inner: tree_sitter::QueryCapture<'a>,
}

impl<'a> QueryCapture<'a> {
impl QueryCapture<'_> {
#[inline]
pub fn node(&self) -> Node {
self.inner.node.into()
Expand All @@ -21,7 +21,7 @@ mod native {
}
}

impl<'a> std::fmt::Debug for QueryCapture<'a> {
impl std::fmt::Debug for QueryCapture<'_> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Debug::fmt(&self.inner, fmt)
}
Expand All @@ -41,11 +41,11 @@ mod native {
}
}

impl<'a> std::panic::RefUnwindSafe for QueryCapture<'a> {}
impl std::panic::RefUnwindSafe for QueryCapture<'_> {}

impl<'a> Unpin for QueryCapture<'a> {}
impl Unpin for QueryCapture<'_> {}

impl<'a> std::panic::UnwindSafe for QueryCapture<'a> {}
impl std::panic::UnwindSafe for QueryCapture<'_> {}
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down
10 changes: 5 additions & 5 deletions topiary-tree-sitter-facade/src/query_predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod native {
pub(crate) inner: &'query tree_sitter::QueryPredicate,
}

impl<'query> QueryPredicate<'query> {
impl QueryPredicate<'_> {
#[inline]
pub fn operator(&self) -> Cow<str> {
Cow::Borrowed(&self.inner.operator)
Expand All @@ -30,7 +30,7 @@ mod native {
}
}

impl<'query> std::fmt::Debug for QueryPredicate<'query> {
impl std::fmt::Debug for QueryPredicate<'_> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Debug::fmt(&self.inner, fmt)
}
Expand All @@ -43,11 +43,11 @@ mod native {
}
}

impl<'query> std::panic::RefUnwindSafe for QueryPredicate<'query> {}
impl std::panic::RefUnwindSafe for QueryPredicate<'_> {}

impl<'query> Unpin for QueryPredicate<'query> {}
impl Unpin for QueryPredicate<'_> {}

impl<'query> std::panic::UnwindSafe for QueryPredicate<'query> {}
impl std::panic::UnwindSafe for QueryPredicate<'_> {}
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down
6 changes: 3 additions & 3 deletions topiary-tree-sitter-facade/src/tree_cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ mod native {
}
}

impl<'a> std::panic::RefUnwindSafe for TreeCursor<'a> {}
impl std::panic::RefUnwindSafe for TreeCursor<'_> {}

impl<'a> Unpin for TreeCursor<'a> {}
impl Unpin for TreeCursor<'_> {}

impl<'a> std::panic::UnwindSafe for TreeCursor<'a> {}
impl std::panic::UnwindSafe for TreeCursor<'_> {}
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down
Loading