Skip to content

Commit

Permalink
Remove leading :: from paths
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceManiac committed Apr 5, 2020
1 parent 49ae639 commit 278ec2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/hullrot-client/lib.rs
Expand Up @@ -88,7 +88,7 @@ fn with_handle<F: FnOnce(&mut Handle) -> *const c_char>(f: F) -> *const c_char {
unsafe fn parse_args<'a>(argc: c_int, argv: *const *const c_char) -> Vec<&'a [u8]> {
let mut args = Vec::new();
for i in 0..argc as isize {
args.push(::std::ffi::CStr::from_ptr(*argv.offset(i)).to_bytes());
args.push(std::ffi::CStr::from_ptr(*argv.offset(i)).to_bytes());
}
args
}
Expand Down Expand Up @@ -217,7 +217,7 @@ struct Init {
stream: TcpStream,
}

fn init_control(addr: &str) -> Result<Init, Box<dyn (::std::error::Error)>> {
fn init_control(addr: &str) -> Result<Init, Box<dyn std::error::Error>> {
let poll = Poll::new()?;
let addr = addr.parse()?;
let stream = TcpStream::connect(&addr)?;
Expand All @@ -233,7 +233,7 @@ fn control_thread(init: Init, control_rx: mpsc::Receiver<Vec<u8>>, event_tx: mps
let mut write_buf = hullrot_common::BufWriter::new();

'main: loop {
if let Err(e) = poll.poll(&mut events, Some(::std::time::Duration::from_millis(5))) {
if let Err(e) = poll.poll(&mut events, Some(std::time::Duration::from_millis(5))) {
return control_fatal(&event_tx, &e.to_string());
}

Expand Down
10 changes: 5 additions & 5 deletions src/hullrot-server/config.rs
Expand Up @@ -74,7 +74,7 @@ impl Default for Config {

impl Config {
/// Load the config from a file.
pub fn load(path: &Path, default: bool) -> Result<Config, Box<dyn (::std::error::Error)>> {
pub fn load(path: &Path, default: bool) -> Result<Config, Box<dyn std::error::Error>> {
println!("Loading {}", path.display());
let mut buf = Vec::new();
match File::open(path) {
Expand All @@ -92,7 +92,7 @@ impl Config {
}

/// Save the config to a file.
fn save(&self, path: &Path) -> Result<(), Box<dyn (::std::error::Error)>> {
fn save(&self, path: &Path) -> Result<(), Box<dyn std::error::Error>> {
let mut file = File::create(path)?;
file.write_all(&toml::ser::to_vec(&SerRoot { hullrot: self })?)?;
Ok(())
Expand All @@ -118,7 +118,7 @@ pub struct AuthDB {
}

impl AuthDB {
fn load_inner(path: &Path) -> Result<BTreeMap<String, String>, Box<dyn (::std::error::Error)>> {
fn load_inner(path: &Path) -> Result<BTreeMap<String, String>, Box<dyn std::error::Error>> {
let mut buf = Vec::new();
match File::open(path) {
Ok(mut file) => { file.read_to_end(&mut buf)?; },
Expand All @@ -131,15 +131,15 @@ impl AuthDB {
}

/// Load the DB from a file. If it does not exist, silently defaults.
pub fn load(path: &Path) -> Result<AuthDB, Box<dyn (::std::error::Error)>> {
pub fn load(path: &Path) -> Result<AuthDB, Box<dyn std::error::Error>> {
println!("Loading {}", path.display());
AuthDB::load_inner(path).map(|assoc| AuthDB {
path: path.to_owned(),
assoc: RefCell::new(assoc)
})
}

fn save(&self, path: &Path) -> Result<(), Box<dyn (::std::error::Error)>> {
fn save(&self, path: &Path) -> Result<(), Box<dyn std::error::Error>> {
File::create(path)?.write_all(&toml::ser::to_vec(&*self.assoc.borrow())?)?;
Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions src/hullrot-server/net.rs
Expand Up @@ -52,7 +52,7 @@ pub struct Init {
udp: UdpSocket,
}

pub fn init_server(config: &Config) -> Result<Init, Box<dyn (::std::error::Error)>> {
pub fn init_server(config: &Config) -> Result<Init, Box<dyn std::error::Error>> {
// TODO: audit
let mut ctx = SslContext::builder(SslMethod::tls())?;
ctx.set_cipher_list("EECDH+AESGCM:EDH+aRSA+AESGCM:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-SHA:AES128-SHA")?;
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn init_server(config: &Config) -> Result<Init, Box<dyn (::std::error::Error
}

#[deny(unused_must_use)]
fn create_self_signed_cert(cert_pem: &str, key_pem: &str) -> Result<(), Box<dyn (::std::error::Error)>> {
fn create_self_signed_cert(cert_pem: &str, key_pem: &str) -> Result<(), Box<dyn std::error::Error>> {
use openssl::x509::*;
use openssl::x509::extension::*;
use openssl::pkey::PKey;
Expand Down Expand Up @@ -166,7 +166,7 @@ pub fn server_thread(init: Init, config: &Config) {

println!("Started");
loop {
poll.poll(&mut events, Some(::std::time::Duration::from_millis(5))).unwrap();
poll.poll(&mut events, Some(std::time::Duration::from_millis(5))).unwrap();

// Check readiness events
for event in events.iter() {
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn server_thread(init: Init, config: &Config) {
connection.hash_delivered = true;
let hash = stream.ssl().peer_certificate()
// Murmur uses SHA-1 so we shall too
.and_then(|cert| cert.digest(::openssl::hash::MessageDigest::sha1()).ok())
.and_then(|cert| cert.digest(openssl::hash::MessageDigest::sha1()).ok())
.map(|digest| {
let mut buf = String::new();
for byte in digest.iter() {
Expand Down

0 comments on commit 278ec2f

Please sign in to comment.