clippy --fix
This commit is contained in:
parent
6a65b9adee
commit
8a1260ed48
@ -76,7 +76,6 @@ impl ClientApiConnection {
|
|||||||
};
|
};
|
||||||
if let Err(e) = reply_channel.send_async(response).await {
|
if let Err(e) = reply_channel.send_async(response).await {
|
||||||
error!("failed to process reply: {}", e);
|
error!("failed to process reply: {}", e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,6 @@ Server Debug Commands:
|
|||||||
_ => {
|
_ => {
|
||||||
ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
|
ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
|
||||||
ui.send_callback(callback);
|
ui.send_callback(callback);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -271,7 +270,6 @@ Server Debug Commands:
|
|||||||
_ => {
|
_ => {
|
||||||
ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
|
ui.add_node_event(Level::Error, format!("unknown flag: {}", flag));
|
||||||
ui.send_callback(callback);
|
ui.send_callback(callback);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -399,12 +397,12 @@ Server Debug Commands:
|
|||||||
}
|
}
|
||||||
pub fn update_route(&self, route: &json::JsonValue) {
|
pub fn update_route(&self, route: &json::JsonValue) {
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
if route["dead_routes"].len() != 0 {
|
if !route["dead_routes"].is_empty() {
|
||||||
out.push_str(&format!("Dead routes: {:?}", route["dead_routes"]));
|
out.push_str(&format!("Dead routes: {:?}", route["dead_routes"]));
|
||||||
}
|
}
|
||||||
if route["dead_routes"].len() != 0 {
|
if !route["dead_routes"].is_empty() {
|
||||||
if !out.is_empty() {
|
if !out.is_empty() {
|
||||||
out.push_str("\n");
|
out.push('\n');
|
||||||
}
|
}
|
||||||
out.push_str(&format!(
|
out.push_str(&format!(
|
||||||
"Dead remote routes: {:?}",
|
"Dead remote routes: {:?}",
|
||||||
@ -460,7 +458,7 @@ Server Debug Commands:
|
|||||||
};
|
};
|
||||||
|
|
||||||
let strmsg = if printable {
|
let strmsg = if printable {
|
||||||
format!("\"{}\"", String::from_utf8_lossy(&message).to_string())
|
format!("\"{}\"", String::from_utf8_lossy(message))
|
||||||
} else {
|
} else {
|
||||||
hex::encode(message)
|
hex::encode(message)
|
||||||
};
|
};
|
||||||
@ -498,7 +496,7 @@ Server Debug Commands:
|
|||||||
};
|
};
|
||||||
|
|
||||||
let strmsg = if printable {
|
let strmsg = if printable {
|
||||||
format!("\"{}\"", String::from_utf8_lossy(&message).to_string())
|
format!("\"{}\"", String::from_utf8_lossy(message))
|
||||||
} else {
|
} else {
|
||||||
hex::encode(message)
|
hex::encode(message)
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ fn main() -> Result<(), String> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut settings = settings::Settings::new(settings_path.as_ref().map(|x| x.as_os_str()))
|
let mut settings = settings::Settings::new(settings_path.as_deref())
|
||||||
.map_err(|e| format!("configuration is invalid: {}", e))?;
|
.map_err(|e| format!("configuration is invalid: {}", e))?;
|
||||||
|
|
||||||
// Set config from command line
|
// Set config from command line
|
||||||
|
@ -58,7 +58,7 @@ impl TableViewItem<PeerTableColumn> for json::JsonValue {
|
|||||||
PeerTableColumn::NodeId => self["node_ids"][0].to_string(),
|
PeerTableColumn::NodeId => self["node_ids"][0].to_string(),
|
||||||
PeerTableColumn::Address => self["peer_address"].to_string(),
|
PeerTableColumn::Address => self["peer_address"].to_string(),
|
||||||
PeerTableColumn::LatencyAvg => {
|
PeerTableColumn::LatencyAvg => {
|
||||||
format!("{}", format_ts(&self["peer_stats"]["latency"]["average"]))
|
format_ts(&self["peer_stats"]["latency"]["average"]).to_string()
|
||||||
}
|
}
|
||||||
PeerTableColumn::TransferDownAvg => {
|
PeerTableColumn::TransferDownAvg => {
|
||||||
format_bps(&self["peer_stats"]["transfer"]["down"]["average"])
|
format_bps(&self["peer_stats"]["transfer"]["down"]["average"])
|
||||||
|
@ -6,7 +6,7 @@ use std::net::{SocketAddr, ToSocketAddrs};
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
pub fn load_default_config() -> Result<config::Config, config::ConfigError> {
|
pub fn load_default_config() -> Result<config::Config, config::ConfigError> {
|
||||||
let default_config = r###"---
|
let default_config = r#"---
|
||||||
address: "localhost:5959"
|
address: "localhost:5959"
|
||||||
autoconnect: true
|
autoconnect: true
|
||||||
autoreconnect: true
|
autoreconnect: true
|
||||||
@ -44,7 +44,7 @@ interface:
|
|||||||
info : "white"
|
info : "white"
|
||||||
warn : "light yellow"
|
warn : "light yellow"
|
||||||
error : "light red"
|
error : "light red"
|
||||||
"###
|
"#
|
||||||
.replace(
|
.replace(
|
||||||
"%LOGGING_FILE_DIRECTORY%",
|
"%LOGGING_FILE_DIRECTORY%",
|
||||||
&Settings::get_default_log_directory().to_string_lossy(),
|
&Settings::get_default_log_directory().to_string_lossy(),
|
||||||
|
@ -469,7 +469,7 @@ impl UI {
|
|||||||
let color = *Self::inner_mut(s).log_colors.get(&Level::Warn).unwrap();
|
let color = *Self::inner_mut(s).log_colors.get(&Level::Warn).unwrap();
|
||||||
cursive_flexi_logger_view::parse_lines_to_log(
|
cursive_flexi_logger_view::parse_lines_to_log(
|
||||||
color.into(),
|
color.into(),
|
||||||
format!(">> Could not copy to clipboard"),
|
">> Could not copy to clipboard".to_string(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -482,9 +482,7 @@ impl UI {
|
|||||||
)
|
)
|
||||||
.as_bytes(),
|
.as_bytes(),
|
||||||
)
|
)
|
||||||
.is_ok()
|
.is_ok() && std::io::stdout().flush().is_ok() {
|
||||||
{
|
|
||||||
if std::io::stdout().flush().is_ok() {
|
|
||||||
let color = *Self::inner_mut(s).log_colors.get(&Level::Info).unwrap();
|
let color = *Self::inner_mut(s).log_colors.get(&Level::Info).unwrap();
|
||||||
cursive_flexi_logger_view::parse_lines_to_log(
|
cursive_flexi_logger_view::parse_lines_to_log(
|
||||||
color.into(),
|
color.into(),
|
||||||
@ -493,7 +491,6 @@ impl UI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn on_submit_peers_table_view(s: &mut Cursive, _row: usize, index: usize) {
|
fn on_submit_peers_table_view(s: &mut Cursive, _row: usize, index: usize) {
|
||||||
let peers_table_view = UI::peers(s);
|
let peers_table_view = UI::peers(s);
|
||||||
@ -523,7 +520,7 @@ impl UI {
|
|||||||
let mut reset: bool = false;
|
let mut reset: bool = false;
|
||||||
match state {
|
match state {
|
||||||
ConnectionState::Disconnected => {
|
ConnectionState::Disconnected => {
|
||||||
if inner.connection_dialog_state == None
|
if inner.connection_dialog_state.is_none()
|
||||||
|| inner
|
|| inner
|
||||||
.connection_dialog_state
|
.connection_dialog_state
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -541,7 +538,7 @@ impl UI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConnectionState::Connected(_, _) => {
|
ConnectionState::Connected(_, _) => {
|
||||||
if inner.connection_dialog_state != None
|
if inner.connection_dialog_state.is_some()
|
||||||
&& !inner
|
&& !inner
|
||||||
.connection_dialog_state
|
.connection_dialog_state
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -552,7 +549,7 @@ impl UI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConnectionState::Retrying(_, _) => {
|
ConnectionState::Retrying(_, _) => {
|
||||||
if inner.connection_dialog_state == None
|
if inner.connection_dialog_state.is_none()
|
||||||
|| inner
|
|| inner
|
||||||
.connection_dialog_state
|
.connection_dialog_state
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -1020,7 +1017,7 @@ impl UISender {
|
|||||||
for l in 0..node_ids.len() {
|
for l in 0..node_ids.len() {
|
||||||
let nid = &node_ids[l];
|
let nid = &node_ids[l];
|
||||||
if !node_id_str.is_empty() {
|
if !node_id_str.is_empty() {
|
||||||
node_id_str.push_str(" ");
|
node_id_str.push(' ');
|
||||||
}
|
}
|
||||||
node_id_str.push_str(nid.to_string().as_ref());
|
node_id_str.push_str(nid.to_string().as_ref());
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ use std::process::{Command, Stdio};
|
|||||||
|
|
||||||
fn search_file<T: AsRef<str>, P: AsRef<str>>(start: T, name: P) -> Option<PathBuf> {
|
fn search_file<T: AsRef<str>, P: AsRef<str>>(start: T, name: P) -> Option<PathBuf> {
|
||||||
let start_path = PathBuf::from(start.as_ref()).canonicalize().ok();
|
let start_path = PathBuf::from(start.as_ref()).canonicalize().ok();
|
||||||
let mut path = start_path.as_ref().map(|x| x.as_path());
|
let mut path = start_path.as_deref();
|
||||||
while let Some(some_path) = path {
|
while let Some(some_path) = path {
|
||||||
let file_path = some_path.join(name.as_ref());
|
let file_path = some_path.join(name.as_ref());
|
||||||
if file_path.exists() {
|
if file_path.exists() {
|
||||||
@ -18,10 +18,8 @@ fn get_desired_capnp_version_string() -> String {
|
|||||||
let capnp_path = search_file(env!("CARGO_MANIFEST_DIR"), ".capnp_version")
|
let capnp_path = search_file(env!("CARGO_MANIFEST_DIR"), ".capnp_version")
|
||||||
.expect("should find .capnp_version file");
|
.expect("should find .capnp_version file");
|
||||||
std::fs::read_to_string(&capnp_path)
|
std::fs::read_to_string(&capnp_path)
|
||||||
.expect(&format!(
|
.unwrap_or_else(|_| panic!("can't read .capnp_version file here: {:?}",
|
||||||
"can't read .capnp_version file here: {:?}",
|
capnp_path))
|
||||||
capnp_path
|
|
||||||
))
|
|
||||||
.trim()
|
.trim()
|
||||||
.to_owned()
|
.to_owned()
|
||||||
}
|
}
|
||||||
@ -47,10 +45,8 @@ fn get_desired_protoc_version_string() -> String {
|
|||||||
let protoc_path = search_file(env!("CARGO_MANIFEST_DIR"), ".protoc_version")
|
let protoc_path = search_file(env!("CARGO_MANIFEST_DIR"), ".protoc_version")
|
||||||
.expect("should find .protoc_version file");
|
.expect("should find .protoc_version file");
|
||||||
std::fs::read_to_string(&protoc_path)
|
std::fs::read_to_string(&protoc_path)
|
||||||
.expect(&format!(
|
.unwrap_or_else(|_| panic!("can't read .protoc_version file here: {:?}",
|
||||||
"can't read .protoc_version file here: {:?}",
|
protoc_path))
|
||||||
protoc_path
|
|
||||||
))
|
|
||||||
.trim()
|
.trim()
|
||||||
.to_owned()
|
.to_owned()
|
||||||
}
|
}
|
||||||
@ -80,10 +76,10 @@ fn main() {
|
|||||||
|
|
||||||
// Check capnp version
|
// Check capnp version
|
||||||
let desired_capnp_major_version =
|
let desired_capnp_major_version =
|
||||||
usize::from_str_radix(desired_capnp_version_string.split_once(".").unwrap().0, 10)
|
usize::from_str_radix(desired_capnp_version_string.split_once('.').unwrap().0, 10)
|
||||||
.expect("should be valid int");
|
.expect("should be valid int");
|
||||||
|
|
||||||
if usize::from_str_radix(capnp_version_string.split_once(".").unwrap().0, 10)
|
if usize::from_str_radix(capnp_version_string.split_once('.').unwrap().0, 10)
|
||||||
.expect("should be valid int")
|
.expect("should be valid int")
|
||||||
!= desired_capnp_major_version
|
!= desired_capnp_major_version
|
||||||
{
|
{
|
||||||
@ -100,9 +96,9 @@ fn main() {
|
|||||||
|
|
||||||
// Check protoc version
|
// Check protoc version
|
||||||
let desired_protoc_major_version =
|
let desired_protoc_major_version =
|
||||||
usize::from_str_radix(desired_protoc_version_string.split_once(".").unwrap().0, 10)
|
usize::from_str_radix(desired_protoc_version_string.split_once('.').unwrap().0, 10)
|
||||||
.expect("should be valid int");
|
.expect("should be valid int");
|
||||||
if usize::from_str_radix(protoc_version_string.split_once(".").unwrap().0, 10)
|
if usize::from_str_radix(protoc_version_string.split_once('.').unwrap().0, 10)
|
||||||
.expect("should be valid int")
|
.expect("should be valid int")
|
||||||
< desired_protoc_major_version
|
< desired_protoc_major_version
|
||||||
{
|
{
|
||||||
|
@ -358,7 +358,7 @@ pub extern "C" fn routing_context(port: i64) {
|
|||||||
let veilid_api = get_veilid_api().await?;
|
let veilid_api = get_veilid_api().await?;
|
||||||
let routing_context = veilid_api.routing_context();
|
let routing_context = veilid_api.routing_context();
|
||||||
let mut rc = ROUTING_CONTEXTS.lock();
|
let mut rc = ROUTING_CONTEXTS.lock();
|
||||||
let new_id = add_routing_context(&mut *rc, routing_context);
|
let new_id = add_routing_context(&mut rc, routing_context);
|
||||||
APIResult::Ok(new_id)
|
APIResult::Ok(new_id)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ pub extern "C" fn release_routing_context(id: u32) -> i32 {
|
|||||||
if rc.remove(&id).is_none() {
|
if rc.remove(&id).is_none() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -381,8 +381,8 @@ pub extern "C" fn routing_context_with_privacy(id: u32) -> u32 {
|
|||||||
let Ok(routing_context) = routing_context.clone().with_privacy() else {
|
let Ok(routing_context) = routing_context.clone().with_privacy() else {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
let new_id = add_routing_context(&mut rc, routing_context);
|
|
||||||
new_id
|
add_routing_context(&mut rc, routing_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -397,8 +397,8 @@ pub extern "C" fn routing_context_with_custom_privacy(id: u32, safety_selection:
|
|||||||
let Ok(routing_context) = routing_context.clone().with_custom_privacy(safety_selection) else {
|
let Ok(routing_context) = routing_context.clone().with_custom_privacy(safety_selection) else {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
let new_id = add_routing_context(&mut rc, routing_context);
|
|
||||||
new_id
|
add_routing_context(&mut rc, routing_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -411,8 +411,8 @@ pub extern "C" fn routing_context_with_sequencing(id: u32, sequencing: FfiStr) -
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
let routing_context = routing_context.clone().with_sequencing(sequencing);
|
let routing_context = routing_context.clone().with_sequencing(sequencing);
|
||||||
let new_id = add_routing_context(&mut rc, routing_context);
|
|
||||||
new_id
|
add_routing_context(&mut rc, routing_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ pub extern "C" fn release_table_db(id: u32) -> i32 {
|
|||||||
if rc.remove(&id).is_none() {
|
if rc.remove(&id).is_none() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -757,7 +757,7 @@ pub extern "C" fn table_db_get_column_count(id: u32) -> u32 {
|
|||||||
let Ok(cc) = table_db.clone().get_column_count() else {
|
let Ok(cc) = table_db.clone().get_column_count() else {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
return cc;
|
cc
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -794,8 +794,8 @@ pub extern "C" fn table_db_transact(id: u32) -> u32 {
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
let tdbt = table_db.clone().transact();
|
let tdbt = table_db.clone().transact();
|
||||||
let tdbtid = add_table_db_transaction(tdbt);
|
|
||||||
return tdbtid;
|
add_table_db_transaction(tdbt)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@ -804,7 +804,7 @@ pub extern "C" fn release_table_db_transaction(id: u32) -> i32 {
|
|||||||
if tdbts.remove(&id).is_none() {
|
if tdbts.remove(&id).is_none() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ impl AssemblyBuffer {
|
|||||||
remote_addr: SocketAddr,
|
remote_addr: SocketAddr,
|
||||||
) -> NetworkResult<Option<Vec<u8>>> {
|
) -> NetworkResult<Option<Vec<u8>>> {
|
||||||
// If we receive a zero length frame, send it
|
// If we receive a zero length frame, send it
|
||||||
if frame.len() == 0 {
|
if frame.is_empty() {
|
||||||
return NetworkResult::value(Some(frame.to_vec()));
|
return NetworkResult::value(Some(frame.to_vec()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,11 +338,9 @@ impl AssemblyBuffer {
|
|||||||
|
|
||||||
// If we are returning a message, see if there are any more assemblies for this peer
|
// If we are returning a message, see if there are any more assemblies for this peer
|
||||||
// If not, remove the peer
|
// If not, remove the peer
|
||||||
if out.is_some() {
|
if out.is_some() && peer_messages.assemblies.is_empty() {
|
||||||
if peer_messages.assemblies.len() == 0 {
|
|
||||||
e.remove();
|
e.remove();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
NetworkResult::value(out)
|
NetworkResult::value(out)
|
||||||
}
|
}
|
||||||
std::collections::hash_map::Entry::Vacant(v) => {
|
std::collections::hash_map::Entry::Vacant(v) => {
|
||||||
@ -361,7 +359,7 @@ impl AssemblyBuffer {
|
|||||||
|
|
||||||
/// Add framing to chunk to send to the wire
|
/// Add framing to chunk to send to the wire
|
||||||
fn frame_chunk(chunk: &[u8], offset: usize, message_len: usize, seq: SequenceType) -> Vec<u8> {
|
fn frame_chunk(chunk: &[u8], offset: usize, message_len: usize, seq: SequenceType) -> Vec<u8> {
|
||||||
assert!(chunk.len() > 0);
|
assert!(!chunk.is_empty());
|
||||||
assert!(message_len <= MAX_LEN);
|
assert!(message_len <= MAX_LEN);
|
||||||
assert!(offset + chunk.len() <= message_len);
|
assert!(offset + chunk.len() <= message_len);
|
||||||
|
|
||||||
@ -403,7 +401,7 @@ impl AssemblyBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do not frame or split anything zero bytes long, just send it
|
// Do not frame or split anything zero bytes long, just send it
|
||||||
if data.len() == 0 {
|
if data.is_empty() {
|
||||||
return sender(data, remote_addr).await;
|
return sender(data, remote_addr).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ fn must_encode_path(c: u8) -> bool {
|
|||||||
fn is_valid_scheme<H: AsRef<str>>(host: H) -> bool {
|
fn is_valid_scheme<H: AsRef<str>>(host: H) -> bool {
|
||||||
let mut chars = host.as_ref().chars();
|
let mut chars = host.as_ref().chars();
|
||||||
if let Some(ch) = chars.next() {
|
if let Some(ch) = chars.next() {
|
||||||
if !matches!(ch, 'A'..='Z' | 'a'..='z') {
|
if !ch.is_ascii_alphabetic() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,10 +242,8 @@ pub fn compatible_unspecified_socket_addr(socket_addr: &SocketAddr) -> SocketAdd
|
|||||||
pub fn listen_address_to_socket_addrs(listen_address: &str) -> Result<Vec<SocketAddr>, String> {
|
pub fn listen_address_to_socket_addrs(listen_address: &str) -> Result<Vec<SocketAddr>, String> {
|
||||||
// If no address is specified, but the port is, use ipv4 and ipv6 unspecified
|
// If no address is specified, but the port is, use ipv4 and ipv6 unspecified
|
||||||
// If the address is specified, only use the specified port and fail otherwise
|
// If the address is specified, only use the specified port and fail otherwise
|
||||||
let ip_addrs = vec![
|
let ip_addrs = [IpAddr::V4(Ipv4Addr::UNSPECIFIED),
|
||||||
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
|
IpAddr::V6(Ipv6Addr::UNSPECIFIED)];
|
||||||
IpAddr::V6(Ipv6Addr::UNSPECIFIED),
|
|
||||||
];
|
|
||||||
|
|
||||||
Ok(if let Some(portstr) = listen_address.strip_prefix(':') {
|
Ok(if let Some(portstr) = listen_address.strip_prefix(':') {
|
||||||
let port = portstr
|
let port = portstr
|
||||||
@ -354,7 +352,7 @@ pub unsafe fn unaligned_u8_vec_uninit(n_bytes: usize) -> Vec<u8> {
|
|||||||
let ptr = unaligned.as_mut_ptr();
|
let ptr = unaligned.as_mut_ptr();
|
||||||
mem::forget(unaligned);
|
mem::forget(unaligned);
|
||||||
|
|
||||||
Vec::from_raw_parts(ptr as *mut u8, n_bytes, n_bytes)
|
Vec::from_raw_parts(ptr, n_bytes, n_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_backtrace() -> String {
|
pub fn debug_backtrace() -> String {
|
||||||
|
Loading…
Reference in New Issue
Block a user