Skip to content

Commit

Permalink
Fix Clippy Linting Errors (#746)
Browse files Browse the repository at this point in the history
* Clippy

* Remove unnecessary explicit lifetime declarations
  • Loading branch information
ambiguousname authored Dec 8, 2024
1 parent 6bd0824 commit b029af6
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions core/src/hir/type_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl TypeContext {
)
}

pub fn all_traits<'tcx>(&'tcx self) -> impl Iterator<Item = (TraitId, &TraitDef)> {
pub fn all_traits<'tcx>(&'tcx self) -> impl Iterator<Item = (TraitId, &'tcx TraitDef)> {
self.traits
.iter()
.enumerate()
Expand Down Expand Up @@ -203,7 +203,7 @@ impl TypeContext {
pub(super) fn from_ast_without_validation<'ast>(
env: &'ast Env,
attr_validator: impl AttributeValidator + 'static,
) -> Result<(LoweringContext, Self), Vec<ErrorAndContext>> {
) -> Result<(LoweringContext<'ast>, Self), Vec<ErrorAndContext>> {
let mut ast_out_structs = SmallVec::<[_; 16]>::new();
let mut ast_structs = SmallVec::<[_; 16]>::new();
let mut ast_opaques = SmallVec::<[_; 16]>::new();
Expand Down
2 changes: 1 addition & 1 deletion tool/src/c/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct TyGenContext<'cx, 'tcx> {
pub impl_header_path: &'cx String,
}

impl<'cx, 'tcx> TyGenContext<'cx, 'tcx> {
impl<'tcx> TyGenContext<'_, 'tcx> {
pub fn gen_enum_def(&self, def: &'tcx hir::EnumDef) -> Header {
let mut decl_header = Header::new(self.decl_header_path.clone(), self.is_for_cpp);
let ty_name = self.formatter.fmt_type_name(self.id.try_into().unwrap());
Expand Down
2 changes: 1 addition & 1 deletion tool/src/cpp/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub(super) struct TyGenContext<'ccx, 'tcx, 'header> {
pub generating_struct_fields: bool,
}

impl<'ccx, 'tcx: 'ccx, 'header> TyGenContext<'ccx, 'tcx, 'header> {
impl<'ccx, 'tcx: 'ccx> TyGenContext<'ccx, 'tcx, '_> {
/// Adds an enum definition to the current decl and impl headers.
///
/// The enum is defined in C++ using a `class` with a single private field that is the
Expand Down
2 changes: 1 addition & 1 deletion tool/src/dart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct TyGenContext<'a, 'cx> {
helper_classes: &'a mut BTreeMap<String, String>,
}

impl<'a, 'cx> TyGenContext<'a, 'cx> {
impl<'cx> TyGenContext<'_, 'cx> {
fn gen(&mut self, id: TypeId) -> (String, String) {
let ty = self.tcx.resolve_type(id);

Expand Down
2 changes: 1 addition & 1 deletion tool/src/demo_gen/terminus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub(super) struct TerminusInfo {
pub imports: BTreeSet<String>,
}

impl<'ctx, 'tcx> RenderTerminusContext<'ctx, 'tcx> {
impl RenderTerminusContext<'_, '_> {
/// See [`TerminusInfo`] for more information on termini.
///
/// Right now, we only check for the existence of `&mut DiplomatWrite` in the function parameters to determine a valid render termini.
Expand Down
2 changes: 1 addition & 1 deletion tool/src/js/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub(super) enum JsToCConversionContext {
WriteToBuffer(&'static str, usize),
}

impl<'jsctx, 'tcx> TyGenContext<'jsctx, 'tcx> {
impl<'tcx> TyGenContext<'_, 'tcx> {
// #region C to JS
/// Given a type from Rust, convert it into something Typescript will understand.
/// We use this to double-check our Javascript work as well.
Expand Down
2 changes: 1 addition & 1 deletion tool/src/js/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(super) struct TyGenContext<'ctx, 'tcx> {
pub imports: RefCell<BTreeSet<String>>,
}

impl<'ctx, 'tcx> TyGenContext<'ctx, 'tcx> {
impl<'tcx> TyGenContext<'_, 'tcx> {
/// Generates the code at the top of every `.d.ts` and `.mjs` file.
///
/// This could easily be an [inherited template](https://djc.github.io/askama/template_syntax.html#template-inheritance), if you want to be a little more strict about how templates are used.
Expand Down
2 changes: 1 addition & 1 deletion tool/src/kotlin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ struct TyGenContext<'a, 'cx> {
callback_params: &'a mut Vec<CallbackParamInfo>,
}

impl<'a, 'cx> TyGenContext<'a, 'cx> {
impl<'cx> TyGenContext<'_, 'cx> {
fn gen_infallible_return_type_name(&self, success_type: &SuccessType) -> Cow<'cx, str> {
match success_type {
SuccessType::Unit => self.formatter.fmt_void().into(),
Expand Down
4 changes: 2 additions & 2 deletions tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct ErrorContext<'tcx> {
method: Option<Cow<'tcx, str>>,
}

impl<'tcx> fmt::Display for ErrorContext<'tcx> {
impl fmt::Display for ErrorContext<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let ty = &self.ty;
if let Some(ref method) = self.method {
Expand All @@ -226,7 +226,7 @@ impl<'tcx> fmt::Display for ErrorContext<'tcx> {
#[must_use]
pub struct ErrorContextGuard<'a, 'tcx, E>(&'a ErrorStore<'tcx, E>, ErrorContext<'tcx>);

impl<'a, 'tcx, E> Drop for ErrorContextGuard<'a, 'tcx, E> {
impl<E> Drop for ErrorContextGuard<'_, '_, E> {
fn drop(&mut self) {
let _ = mem::replace(&mut *self.0.context.borrow_mut(), mem::take(&mut self.1));
}
Expand Down

0 comments on commit b029af6

Please sign in to comment.