Fix warnings.

This commit is contained in:
Trent Waddington 2023-10-10 12:51:11 +10:00
parent 1fec1a5008
commit 72889b8f1a
3 changed files with 31 additions and 2 deletions

View File

@ -10,6 +10,7 @@ pub struct RPCOperationValueChanged {
} }
impl RPCOperationValueChanged { impl RPCOperationValueChanged {
#[allow(dead_code)]
pub fn new( pub fn new(
key: TypedKey, key: TypedKey,
subkeys: ValueSubkeyRangeSet, subkeys: ValueSubkeyRangeSet,
@ -29,18 +30,27 @@ impl RPCOperationValueChanged {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn key(&self) -> &TypedKey { pub fn key(&self) -> &TypedKey {
&self.key &self.key
} }
#[allow(dead_code)]
pub fn subkeys(&self) -> &ValueSubkeyRangeSet { pub fn subkeys(&self) -> &ValueSubkeyRangeSet {
&self.subkeys &self.subkeys
} }
#[allow(dead_code)]
pub fn count(&self) -> u32 { pub fn count(&self) -> u32 {
self.count self.count
} }
#[allow(dead_code)]
pub fn value(&self) -> &SignedValueData { pub fn value(&self) -> &SignedValueData {
&self.value &self.value
} }
#[allow(dead_code)]
pub fn destructure(self) -> (TypedKey, ValueSubkeyRangeSet, u32, SignedValueData) { pub fn destructure(self) -> (TypedKey, ValueSubkeyRangeSet, u32, SignedValueData) {
(self.key, self.subkeys, self.count, self.value) (self.key, self.subkeys, self.count, self.value)
} }

View File

@ -14,6 +14,7 @@ pub struct RPCOperationWatchValueQ {
} }
impl RPCOperationWatchValueQ { impl RPCOperationWatchValueQ {
#[allow(dead_code)]
pub fn new( pub fn new(
key: TypedKey, key: TypedKey,
subkeys: ValueSubkeyRangeSet, subkeys: ValueSubkeyRangeSet,
@ -70,25 +71,37 @@ impl RPCOperationWatchValueQ {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn key(&self) -> &TypedKey { pub fn key(&self) -> &TypedKey {
&self.key &self.key
} }
#[allow(dead_code)]
pub fn subkeys(&self) -> &ValueSubkeyRangeSet { pub fn subkeys(&self) -> &ValueSubkeyRangeSet {
&self.subkeys &self.subkeys
} }
#[allow(dead_code)]
pub fn expiration(&self) -> u64 { pub fn expiration(&self) -> u64 {
self.expiration self.expiration
} }
#[allow(dead_code)]
pub fn count(&self) -> u32 { pub fn count(&self) -> u32 {
self.count self.count
} }
#[allow(dead_code)]
pub fn watcher(&self) -> &PublicKey { pub fn watcher(&self) -> &PublicKey {
&self.watcher &self.watcher
} }
#[allow(dead_code)]
pub fn signature(&self) -> &Signature { pub fn signature(&self) -> &Signature {
&self.signature &self.signature
} }
#[allow(dead_code)]
pub fn destructure( pub fn destructure(
self, self,
) -> ( ) -> (
@ -192,6 +205,7 @@ pub struct RPCOperationWatchValueA {
} }
impl RPCOperationWatchValueA { impl RPCOperationWatchValueA {
#[allow(dead_code)]
pub fn new(expiration: u64, peers: Vec<PeerInfo>) -> Result<Self, RPCError> { pub fn new(expiration: u64, peers: Vec<PeerInfo>) -> Result<Self, RPCError> {
if peers.len() > MAX_WATCH_VALUE_A_PEERS_LEN { if peers.len() > MAX_WATCH_VALUE_A_PEERS_LEN {
return Err(RPCError::protocol("WatchValueA peers length too long")); return Err(RPCError::protocol("WatchValueA peers length too long"));
@ -204,12 +218,15 @@ impl RPCOperationWatchValueA {
Ok(()) Ok(())
} }
#[allow(dead_code)]
pub fn expiration(&self) -> u64 { pub fn expiration(&self) -> u64 {
self.expiration self.expiration
} }
#[allow(dead_code)]
pub fn peers(&self) -> &[PeerInfo] { pub fn peers(&self) -> &[PeerInfo] {
&self.peers &self.peers
} }
#[allow(dead_code)]
pub fn destructure(self) -> (u64, Vec<PeerInfo>) { pub fn destructure(self) -> (u64, Vec<PeerInfo>) {
(self.expiration, self.peers) (self.expiration, self.peers)
} }

View File

@ -11,7 +11,7 @@ use windows_service::*;
// Register generated `ffi_service_main` with the system and start the service, blocking // Register generated `ffi_service_main` with the system and start the service, blocking
// this thread until the service is stopped. // this thread until the service is stopped.
pub fn run_service(settings: Settings, _args: CmdlineArgs) -> EyreResult<()> { pub fn run_service(_settings: Settings, _args: CmdlineArgs) -> EyreResult<()> {
eprintln!("Windows Service mode not implemented yet."); eprintln!("Windows Service mode not implemented yet.");
//service_dispatcher::start("veilid-server", ffi_veilid_service_main)?; //service_dispatcher::start("veilid-server", ffi_veilid_service_main)?;
@ -21,6 +21,7 @@ pub fn run_service(settings: Settings, _args: CmdlineArgs) -> EyreResult<()> {
/////////////// ///////////////
define_windows_service!(ffi_veilid_service_main, veilid_service_main); define_windows_service!(ffi_veilid_service_main, veilid_service_main);
#[allow(dead_code)]
fn veilid_service_main(arguments: Vec<OsString>) { fn veilid_service_main(arguments: Vec<OsString>) {
if let Err(e) = register_service_handler(arguments) { if let Err(e) = register_service_handler(arguments) {
error!("{}", e); error!("{}", e);
@ -29,7 +30,8 @@ fn veilid_service_main(arguments: Vec<OsString>) {
/////////////// ///////////////
fn register_service_handler(arguments: Vec<OsString>) -> windows_service::Result<()> { #[allow(dead_code)]
fn register_service_handler(_arguments: Vec<OsString>) -> windows_service::Result<()> {
let event_handler = move |control_event| -> ServiceControlHandlerResult { let event_handler = move |control_event| -> ServiceControlHandlerResult {
match control_event { match control_event {
ServiceControl::Stop => { ServiceControl::Stop => {