Remove the last bits of unknown_os in the code base (#9718)

* Remove the last bits of unknown_os in the code base

* Fmt
This commit is contained in:
Bastian Köcher
2021-09-09 11:17:16 +02:00
committed by GitHub
parent a443944167
commit 129c9ed09e
28 changed files with 197 additions and 523 deletions
+2 -3
View File
@@ -22,8 +22,7 @@ use crate::{
config::{Configuration, KeystoreConfig, PrometheusConfig, TransactionStorageMode},
error::Error,
metrics::MetricsService,
start_rpc_servers, MallocSizeOfWasm, RpcHandlers, SpawnTaskHandle, TaskManager,
TransactionPoolAdapter,
start_rpc_servers, RpcHandlers, SpawnTaskHandle, TaskManager, TransactionPoolAdapter,
};
use futures::{channel::oneshot, future::ready, FutureExt, StreamExt};
use jsonrpc_pubsub::manager::SubscriptionManager;
@@ -552,7 +551,7 @@ where
TBl::Header: Unpin,
TBackend: 'static + sc_client_api::backend::Backend<TBl> + Send,
TExPool: MaintainedTransactionPool<Block = TBl, Hash = <TBl as BlockT>::Hash>
+ MallocSizeOfWasm
+ parity_util_mem::MallocSizeOf
+ 'static,
TRpc: sc_rpc::RpcExtension<sc_rpc::Metadata>,
{
-5
View File
@@ -43,7 +43,6 @@ use std::{
pin::Pin,
sync::Arc,
};
#[cfg(not(target_os = "unknown"))]
use tempfile::TempDir;
/// Service configuration.
@@ -253,7 +252,6 @@ impl Default for RpcMethods {
#[derive(Debug)]
pub enum BasePath {
/// A temporary directory is used as base path and will be deleted when dropped.
#[cfg(not(target_os = "unknown"))]
Temporary(TempDir),
/// A path on the disk.
Permanenent(PathBuf),
@@ -265,7 +263,6 @@ impl BasePath {
///
/// Note: the temporary directory will be created automatically and deleted when the `BasePath`
/// instance is dropped.
#[cfg(not(target_os = "unknown"))]
pub fn new_temp_dir() -> io::Result<BasePath> {
Ok(BasePath::Temporary(tempfile::Builder::new().prefix("substrate").tempdir()?))
}
@@ -279,7 +276,6 @@ impl BasePath {
}
/// Create a base path from values describing the project.
#[cfg(not(target_os = "unknown"))]
pub fn from_project(qualifier: &str, organization: &str, application: &str) -> BasePath {
BasePath::new(
directories::ProjectDirs::from(qualifier, organization, application)
@@ -291,7 +287,6 @@ impl BasePath {
/// Retrieve the base path.
pub fn path(&self) -> &Path {
match self {
#[cfg(not(target_os = "unknown"))]
BasePath::Temporary(temp_dir) => temp_dir.path(),
BasePath::Permanenent(path) => path.as_path(),
}
-30
View File
@@ -39,7 +39,6 @@ use std::{collections::HashMap, io, net::SocketAddr, pin::Pin, task::Poll};
use codec::{Decode, Encode};
use futures::{stream, Future, FutureExt, Stream, StreamExt};
use log::{debug, error, warn};
use parity_util_mem::MallocSizeOf;
use sc_network::PeerId;
use sc_utils::mpsc::TracingUnboundedReceiver;
use sp_runtime::{
@@ -81,16 +80,6 @@ pub use task_manager::{SpawnTaskHandle, TaskManager};
const DEFAULT_PROTOCOL_ID: &str = "sup";
/// A type that implements `MallocSizeOf` on native but not wasm.
#[cfg(not(target_os = "unknown"))]
pub trait MallocSizeOfWasm: MallocSizeOf {}
#[cfg(target_os = "unknown")]
pub trait MallocSizeOfWasm {}
#[cfg(not(target_os = "unknown"))]
impl<T: MallocSizeOf> MallocSizeOfWasm for T {}
#[cfg(target_os = "unknown")]
impl<T> MallocSizeOfWasm for T {}
/// RPC handlers that can perform RPC queries.
#[derive(Clone)]
pub struct RpcHandlers(
@@ -305,7 +294,6 @@ async fn build_network_future<
}
// Wrapper for HTTP and WS servers that makes sure they are properly shut down.
#[cfg(not(target_os = "unknown"))]
mod waiting {
pub struct HttpServer(pub Option<sc_rpc_server::HttpServer>);
impl Drop for HttpServer {
@@ -340,7 +328,6 @@ mod waiting {
/// Starts RPC servers that run in their own thread, and returns an opaque object that keeps them
/// alive.
#[cfg(not(target_os = "unknown"))]
fn start_rpc_servers<
H: FnMut(
sc_rpc::DenyUnsafe,
@@ -445,23 +432,6 @@ fn start_rpc_servers<
)))
}
/// Starts RPC servers that run in their own thread, and returns an opaque object that keeps them
/// alive.
#[cfg(target_os = "unknown")]
fn start_rpc_servers<
H: FnMut(
sc_rpc::DenyUnsafe,
sc_rpc_server::RpcMiddleware,
) -> Result<sc_rpc_server::RpcHandler<sc_rpc::Metadata>, Error>,
>(
_: &Configuration,
_: H,
_: Option<sc_rpc_server::RpcMetrics>,
_: sc_rpc_server::ServerMetrics,
) -> Result<Box<dyn std::any::Any + Send + Sync>, error::Error> {
Ok(Box::new(()))
}
/// An RPC session. Used to perform in-memory RPC queries (ie. RPC queries that don't go through
/// the HTTP or WebSockets server).
#[derive(Clone)]