Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ambiguousname committed Dec 12, 2024
1 parent 9a3bb20 commit f5f17f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tool/src/js/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'tcx> TyGenContext<'_, 'tcx> {

// Add to the import list:
self.add_import(
type_name.clone().into(),
type_name.clone(),
None,
super::gen::ImportUsage::Both,
);
Expand All @@ -93,7 +93,7 @@ impl<'tcx> TyGenContext<'_, 'tcx> {

// Add to the import list:
self.add_import(
type_name.clone().into(),
type_name.clone(),
None,
super::gen::ImportUsage::Both,
);
Expand All @@ -110,7 +110,7 @@ impl<'tcx> TyGenContext<'_, 'tcx> {

// Add to the import list:
self.add_import(
type_name.clone().into(),
type_name.clone(),
None,
super::gen::ImportUsage::Both,
);
Expand Down Expand Up @@ -466,7 +466,7 @@ impl<'tcx> TyGenContext<'_, 'tcx> {
let (requires_buf, error_ret) = match return_type {
ReturnType::Fallible(s, Some(e)) => {
let type_name = self.formatter.fmt_type_name(e.id().unwrap());
self.add_import(type_name.into(), None, super::gen::ImportUsage::Both);
self.add_import(type_name, None, super::gen::ImportUsage::Both);

let fields_empty = matches!(e, Type::Struct(s) if match s.resolve(self.tcx) {
ReturnableStructDef::Struct(s) => s.fields.is_empty(),
Expand Down
5 changes: 1 addition & 4 deletions tool/src/js/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl<'tcx> TyGenContext<'_, 'tcx> {
.fmt_file_name_extensionless(&import_str)
.into(),
),
usage: usage.clone(),
};
if usage == ImportUsage::Module || usage == ImportUsage::Both {
self.imports.borrow_mut().js.insert(inf.clone());
Expand All @@ -114,7 +113,6 @@ impl<'tcx> TyGenContext<'_, 'tcx> {
let inf = ImportInfo {
import_type: import_str,
import_file: import_file.unwrap_or_default(),
usage: usage.clone(),
};

if usage == ImportUsage::Module || usage == ImportUsage::Both {
Expand Down Expand Up @@ -743,7 +741,6 @@ pub(super) enum ImportUsage {
pub(super) struct ImportInfo<'info> {
import_type: Cow<'info, str>,
import_file: Cow<'info, str>,
usage: ImportUsage,
}

/// Imports are only unique if they use a different type. We don't care about anything else.
Expand All @@ -755,7 +752,7 @@ impl<'info> Ord for ImportInfo<'info> {

impl<'info> PartialOrd for ImportInfo<'info> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.import_type.partial_cmp(&other.import_type)
Some(self.import_type.cmp(&other.import_type))
}
}

Expand Down
2 changes: 1 addition & 1 deletion tool/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub(crate) fn run<'tcx>(

// Remove our self reference:
context.remove_import(
context.type_name.clone().into(),
context.type_name.clone(),
None,
gen::ImportUsage::Both,
);
Expand Down

0 comments on commit f5f17f0

Please sign in to comment.