From d90742277d76953577ccfa6cc765e54b42e3d7d0 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 27 Aug 2020 06:07:49 +0200 Subject: [PATCH] Format source code and fix clippy warning (#443) --- .github/workflows/ci.yml | 10 +++++++--- src/binding.cc | 13 ++++++------- src/scope.rs | 5 +---- tools/download_file.py | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d2851937..9e607037 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,11 +149,13 @@ jobs: echo "::add-path::$(pwd)/$basename" - name: Test - run: cargo test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} + run: + cargo test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }} - name: Clippy - run: cargo clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} + run: + cargo clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }} --target ${{ matrix.config.target }} -- -D clippy::all - name: Rustfmt @@ -166,7 +168,9 @@ jobs: - name: Binary publish uses: softprops/action-gh-release@v1 - if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/') + if: >- + github.repository == 'denoland/rusty_v8' && + startsWith(github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/src/binding.cc b/src/binding.cc index c9a292df..f06f4f86 100644 --- a/src/binding.cc +++ b/src/binding.cc @@ -1740,7 +1740,7 @@ bool v8__Module__IsSourceTextModule(const v8::Module& self) { return ptr_to_local(&self)->IsSourceTextModule(); } -bool v8__Module__IsSyntheticModule(const v8::Module&self) { +bool v8__Module__IsSyntheticModule(const v8::Module& self) { return ptr_to_local(&self)->IsSyntheticModule(); } @@ -1753,8 +1753,7 @@ const v8::Module* v8__Module__CreateSyntheticModule( export_names.push_back(ptr_to_local(export_names_raw[i])); } return local_to_ptr(v8::Module::CreateSyntheticModule( - isolate, ptr_to_local(module_name), export_names, - evaluation_steps)); + isolate, ptr_to_local(module_name), export_names, evaluation_steps)); } MaybeBool v8__Module__SetSyntheticModuleExport(const v8::Module& self, @@ -1762,7 +1761,7 @@ MaybeBool v8__Module__SetSyntheticModuleExport(const v8::Module& self, const v8::String* export_name, const v8::Value* export_value) { return maybe_to_maybe_bool(ptr_to_local(&self)->SetSyntheticModuleExport( - isolate, ptr_to_local(export_name), ptr_to_local(export_value))); + isolate, ptr_to_local(export_name), ptr_to_local(export_value))); } using HeapSnapshotCallback = bool (*)(void*, const char*, size_t); @@ -1837,9 +1836,9 @@ void v8__HeapStatistics__CONSTRUCT(uninit_t* buf) { // The const_cast doesn't violate const correctness, the methods // are simple getters that don't mutate the object or global state. -#define V(name) \ - size_t v8__HeapStatistics__##name(const v8::HeapStatistics* s) { \ - return const_cast(s)->name(); \ +#define V(name) \ + size_t v8__HeapStatistics__##name(const v8::HeapStatistics* s) { \ + return const_cast(s)->name(); \ } V(total_heap_size) diff --git a/src/scope.rs b/src/scope.rs index 4fd649c0..cb09bc61 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -1420,10 +1420,7 @@ pub(crate) mod data { impl ScopeTypeSpecificData { pub fn is_none(&self) -> bool { - match self { - Self::None => true, - _ => false, - } + matches!(self, Self::None) } /// Replaces a `ScopeTypeSpecificData::None` value with the value returned diff --git a/tools/download_file.py b/tools/download_file.py index 901387d2..cf6f1564 100755 --- a/tools/download_file.py +++ b/tools/download_file.py @@ -15,6 +15,7 @@ except ImportError: # For Py3 compatibility from urllib.error import HTTPError, URLError from urllib.request import urlopen + def DownloadUrl(url, output_file): """Download url into output_file.""" CHUNK_SIZE = 4096