0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2025-03-09 05:27:08 -04:00

Narrow dead_code allowance (#818)

This commit is contained in:
Ryan Dahl 2021-10-28 16:29:04 -04:00 committed by GitHub
parent 57a00141d7
commit 8297216a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 16 deletions

View file

@ -397,6 +397,7 @@ impl HandleHost {
) )
} }
#[allow(dead_code)]
fn match_isolate(self, isolate: &mut Isolate) -> bool { fn match_isolate(self, isolate: &mut Isolate) -> bool {
self.match_host(isolate.into(), Some(isolate)) self.match_host(isolate.into(), Some(isolate))
} }
@ -413,6 +414,7 @@ impl HandleHost {
} }
} }
#[allow(dead_code)]
fn get_isolate_handle(self) -> IsolateHandle { fn get_isolate_handle(self) -> IsolateHandle {
unsafe { self.get_isolate().as_ref() }.thread_safe_handle() unsafe { self.get_isolate().as_ref() }.thread_safe_handle()
} }

View file

@ -379,12 +379,14 @@ impl Isolate {
/// Retrieve embedder-specific data from the isolate. /// Retrieve embedder-specific data from the isolate.
/// Returns NULL if SetData has never been called for the given `slot`. /// Returns NULL if SetData has never been called for the given `slot`.
#[allow(dead_code)]
fn get_data(&self, slot: u32) -> *mut c_void { fn get_data(&self, slot: u32) -> *mut c_void {
unsafe { v8__Isolate__GetData(self, slot + Self::INTERNAL_SLOT_COUNT) } unsafe { v8__Isolate__GetData(self, slot + Self::INTERNAL_SLOT_COUNT) }
} }
/// Returns the maximum number of available embedder data slots. Valid slots /// Returns the maximum number of available embedder data slots. Valid slots
/// are in the range of 0 - `Isolate::get_number_of_data_slots() - 1`. /// are in the range of 0 - `Isolate::get_number_of_data_slots() - 1`.
#[allow(dead_code)]
fn get_number_of_data_slots(&self) -> u32 { fn get_number_of_data_slots(&self) -> u32 {
unsafe { unsafe {
v8__Isolate__GetNumberOfDataSlots(self) - Self::INTERNAL_SLOT_COUNT v8__Isolate__GetNumberOfDataSlots(self) - Self::INTERNAL_SLOT_COUNT

View file

@ -3,7 +3,6 @@
//! # Example //! # Example
//! //!
//! ```rust //! ```rust
//! //!
//! let platform = v8::new_default_platform(0, false).make_shared(); //! let platform = v8::new_default_platform(0, false).make_shared();
//! v8::V8::initialize_platform(platform); //! v8::V8::initialize_platform(platform);
//! v8::V8::initialize(); //! v8::V8::initialize();
@ -24,13 +23,11 @@
//! ``` //! ```
#![allow(clippy::missing_safety_doc)] #![allow(clippy::missing_safety_doc)]
#![allow(dead_code)]
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate libc;
mod array_buffer; mod array_buffer;
mod array_buffer_view; mod array_buffer_view;

View file

@ -101,6 +101,7 @@ impl<'a> std::ops::Deref for CachedData<'a> {
} }
} }
#[allow(dead_code)]
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
enum BufferPolicy { enum BufferPolicy {

View file

@ -77,9 +77,11 @@ extern "C" {
length: int, length: int,
) -> *const String; ) -> *const String;
#[allow(dead_code)]
fn v8__String__IsExternal(this: *const String) -> bool; fn v8__String__IsExternal(this: *const String) -> bool;
fn v8__String__IsExternalOneByte(this: *const String) -> bool; fn v8__String__IsExternalOneByte(this: *const String) -> bool;
fn v8__String__IsExternalTwoByte(this: *const String) -> bool; fn v8__String__IsExternalTwoByte(this: *const String) -> bool;
#[allow(dead_code)]
fn v8__String__IsOneByte(this: *const String) -> bool; fn v8__String__IsOneByte(this: *const String) -> bool;
fn v8__String__ContainsOnlyOneByte(this: *const String) -> bool; fn v8__String__ContainsOnlyOneByte(this: *const String) -> bool;
} }

View file

@ -42,6 +42,7 @@ extern "C" {
fn v8__Value__IsRegExp(this: *const Value) -> bool; fn v8__Value__IsRegExp(this: *const Value) -> bool;
fn v8__Value__IsAsyncFunction(this: *const Value) -> bool; fn v8__Value__IsAsyncFunction(this: *const Value) -> bool;
fn v8__Value__IsGeneratorFunction(this: *const Value) -> bool; fn v8__Value__IsGeneratorFunction(this: *const Value) -> bool;
#[allow(dead_code)]
fn v8__Value__IsGeneratorObject(this: *const Value) -> bool; fn v8__Value__IsGeneratorObject(this: *const Value) -> bool;
fn v8__Value__IsPromise(this: *const Value) -> bool; fn v8__Value__IsPromise(this: *const Value) -> bool;
fn v8__Value__IsMap(this: *const Value) -> bool; fn v8__Value__IsMap(this: *const Value) -> bool;

View file

@ -150,11 +150,10 @@ extern "C" {
/// The ValueDeserializerImpl trait allows for /// The ValueDeserializerImpl trait allows for
/// custom callback functions used by v8. /// custom callback functions used by v8.
pub trait ValueDeserializerImpl { pub trait ValueDeserializerImpl {
#[allow(unused_variables)]
fn read_host_object<'s>( fn read_host_object<'s>(
&mut self, &mut self,
scope: &mut HandleScope<'s>, scope: &mut HandleScope<'s>,
value_deserializer: &mut dyn ValueDeserializerHelper, _value_deserializer: &mut dyn ValueDeserializerHelper,
) -> Option<Local<'s, Object>> { ) -> Option<Local<'s, Object>> {
let msg = let msg =
String::new(scope, "Deno deserializer: read_host_object not implemented") String::new(scope, "Deno deserializer: read_host_object not implemented")
@ -164,11 +163,10 @@ pub trait ValueDeserializerImpl {
None None
} }
#[allow(unused_variables)]
fn get_shared_array_buffer_from_id<'s>( fn get_shared_array_buffer_from_id<'s>(
&mut self, &mut self,
scope: &mut HandleScope<'s>, scope: &mut HandleScope<'s>,
transfer_id: u32, _transfer_id: u32,
) -> Option<Local<'s, SharedArrayBuffer>> { ) -> Option<Local<'s, SharedArrayBuffer>> {
let msg = String::new( let msg = String::new(
scope, scope,
@ -180,11 +178,10 @@ pub trait ValueDeserializerImpl {
None None
} }
#[allow(unused_variables)]
fn get_wasm_module_from_id<'s>( fn get_wasm_module_from_id<'s>(
&mut self, &mut self,
scope: &mut HandleScope<'s>, scope: &mut HandleScope<'s>,
clone_id: u32, _clone_id: u32,
) -> Option<Local<'s, WasmModuleObject>> { ) -> Option<Local<'s, WasmModuleObject>> {
let msg = String::new( let msg = String::new(
scope, scope,
@ -221,6 +218,7 @@ impl<'a, 's> ValueDeserializerHeap<'a, 's> {
} }
/// Starting from 'this' pointer a ValueDeserializerHeap ref can be created /// Starting from 'this' pointer a ValueDeserializerHeap ref can be created
#[allow(dead_code)]
pub unsafe fn dispatch( pub unsafe fn dispatch(
value_serializer_delegate: &'s CxxValueDeserializerDelegate, value_serializer_delegate: &'s CxxValueDeserializerDelegate,
) -> &Self { ) -> &Self {

View file

@ -210,12 +210,11 @@ pub trait ValueSerializerImpl {
message: Local<'s, String>, message: Local<'s, String>,
); );
#[allow(unused_variables)]
fn write_host_object<'s>( fn write_host_object<'s>(
&mut self, &mut self,
scope: &mut HandleScope<'s>, scope: &mut HandleScope<'s>,
object: Local<'s, Object>, _object: Local<'s, Object>,
value_serializer: &mut dyn ValueSerializerHelper, _value_serializer: &mut dyn ValueSerializerHelper,
) -> Option<bool> { ) -> Option<bool> {
let msg = let msg =
String::new(scope, "Deno serializer: write_host_object not implemented") String::new(scope, "Deno serializer: write_host_object not implemented")
@ -225,11 +224,10 @@ pub trait ValueSerializerImpl {
None None
} }
#[allow(unused_variables)]
fn get_shared_array_buffer_id<'s>( fn get_shared_array_buffer_id<'s>(
&mut self, &mut self,
scope: &mut HandleScope<'s>, scope: &mut HandleScope<'s>,
shared_array_buffer: Local<'s, SharedArrayBuffer>, _shared_array_buffer: Local<'s, SharedArrayBuffer>,
) -> Option<u32> { ) -> Option<u32> {
let msg = String::new( let msg = String::new(
scope, scope,
@ -241,11 +239,10 @@ pub trait ValueSerializerImpl {
None None
} }
#[allow(unused_variables)]
fn get_wasm_module_transfer_id( fn get_wasm_module_transfer_id(
&mut self, &mut self,
scope: &mut HandleScope<'_>, scope: &mut HandleScope<'_>,
module: Local<WasmModuleObject>, _module: Local<WasmModuleObject>,
) -> Option<u32> { ) -> Option<u32> {
let msg = String::new( let msg = String::new(
scope, scope,
@ -283,6 +280,7 @@ impl<'a, 's> ValueSerializerHeap<'a, 's> {
} }
/// Starting from 'this' pointer a ValueSerializerHeap ref can be created /// Starting from 'this' pointer a ValueSerializerHeap ref can be created
#[allow(dead_code)]
pub unsafe fn dispatch( pub unsafe fn dispatch(
value_serializer_delegate: &'s CxxValueSerializerDelegate, value_serializer_delegate: &'s CxxValueSerializerDelegate,
) -> &Self { ) -> &Self {