Format source code and fix clippy warning (#443)

This commit is contained in:
Bert Belder 2020-08-27 06:07:49 +02:00
parent 6d5686cd7c
commit d90742277d
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461
4 changed files with 15 additions and 14 deletions

View File

@ -149,11 +149,13 @@ jobs:
echo "::add-path::$(pwd)/$basename" echo "::add-path::$(pwd)/$basename"
- name: Test - 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 }} --target ${{ matrix.config.target }}
- name: Clippy - 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 --target ${{ matrix.config.target }} -- -D clippy::all
- name: Rustfmt - name: Rustfmt
@ -166,7 +168,9 @@ jobs:
- name: Binary publish - name: Binary publish
uses: softprops/action-gh-release@v1 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:

View File

@ -1740,7 +1740,7 @@ bool v8__Module__IsSourceTextModule(const v8::Module& self) {
return ptr_to_local(&self)->IsSourceTextModule(); 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(); 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])); export_names.push_back(ptr_to_local(export_names_raw[i]));
} }
return local_to_ptr(v8::Module::CreateSyntheticModule( return local_to_ptr(v8::Module::CreateSyntheticModule(
isolate, ptr_to_local(module_name), export_names, isolate, ptr_to_local(module_name), export_names, evaluation_steps));
evaluation_steps));
} }
MaybeBool v8__Module__SetSyntheticModuleExport(const v8::Module& self, 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::String* export_name,
const v8::Value* export_value) { const v8::Value* export_value) {
return maybe_to_maybe_bool(ptr_to_local(&self)->SetSyntheticModuleExport( 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); using HeapSnapshotCallback = bool (*)(void*, const char*, size_t);
@ -1837,9 +1836,9 @@ void v8__HeapStatistics__CONSTRUCT(uninit_t<v8::HeapStatistics>* buf) {
// The const_cast doesn't violate const correctness, the methods // The const_cast doesn't violate const correctness, the methods
// are simple getters that don't mutate the object or global state. // are simple getters that don't mutate the object or global state.
#define V(name) \ #define V(name) \
size_t v8__HeapStatistics__##name(const v8::HeapStatistics* s) { \ size_t v8__HeapStatistics__##name(const v8::HeapStatistics* s) { \
return const_cast<v8::HeapStatistics*>(s)->name(); \ return const_cast<v8::HeapStatistics*>(s)->name(); \
} }
V(total_heap_size) V(total_heap_size)

View File

@ -1420,10 +1420,7 @@ pub(crate) mod data {
impl ScopeTypeSpecificData { impl ScopeTypeSpecificData {
pub fn is_none(&self) -> bool { pub fn is_none(&self) -> bool {
match self { matches!(self, Self::None)
Self::None => true,
_ => false,
}
} }
/// Replaces a `ScopeTypeSpecificData::None` value with the value returned /// Replaces a `ScopeTypeSpecificData::None` value with the value returned

View File

@ -15,6 +15,7 @@ except ImportError: # For Py3 compatibility
from urllib.error import HTTPError, URLError from urllib.error import HTTPError, URLError
from urllib.request import urlopen from urllib.request import urlopen
def DownloadUrl(url, output_file): def DownloadUrl(url, output_file):
"""Download url into output_file.""" """Download url into output_file."""
CHUNK_SIZE = 4096 CHUNK_SIZE = 4096