Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
Requires rustfmt v2.x
  • Loading branch information
ctz committed Nov 22, 2020
1 parent 7224511 commit f5467c1
Show file tree
Hide file tree
Showing 60 changed files with 5,997 additions and 3,699 deletions.
67 changes: 50 additions & 17 deletions rustls-mio/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::str;
use std::thread;
use std::time;

use regex;
use self::regex::Regex;
use regex;

use ring::rand::SecureRandom;

Expand All @@ -26,8 +26,7 @@ impl DeleteFilesOnDrop {

impl Drop for DeleteFilesOnDrop {
fn drop(&mut self) {
fs::remove_dir_all(&self.path)
.unwrap();
fs::remove_dir_all(&self.path).unwrap();
}
}

Expand Down Expand Up @@ -172,10 +171,12 @@ fn unused_port(mut port: u16) -> u16 {
pub fn skipped(why: &str) {
use std::io;
let mut stdout = io::stdout();
write!(&mut stdout,
"[ SKIPPED ] because: {}\n -- UNTESTED: ",
why)
.unwrap();
write!(
&mut stdout,
"[ SKIPPED ] because: {}\n -- UNTESTED: ",
why
)
.unwrap();
}

pub fn tlsserver_find() -> &'static str {
Expand Down Expand Up @@ -321,7 +322,8 @@ impl TlsClient {
}

pub fn expect(&mut self, expect: &str) -> &mut TlsClient {
self.expect_output.push(expect.to_string());
self.expect_output
.push(expect.to_string());
self
}

Expand Down Expand Up @@ -378,17 +380,35 @@ impl TlsClient {

if self.cafile.is_some() {
args.push("--cafile");
args.push(self.cafile.as_ref().unwrap().to_str().unwrap());
args.push(
self.cafile
.as_ref()
.unwrap()
.to_str()
.unwrap(),
);
}

if self.client_auth_key.is_some() {
args.push("--auth-key");
args.push(self.client_auth_key.as_ref().unwrap().to_str().unwrap());
args.push(
self.client_auth_key
.as_ref()
.unwrap()
.to_str()
.unwrap(),
);
}

if self.client_auth_certs.is_some() {
args.push("--auth-certs");
args.push(self.client_auth_certs.as_ref().unwrap().to_str().unwrap());
args.push(
self.client_auth_certs
.as_ref()
.unwrap()
.to_str()
.unwrap(),
);
}

for suite in &self.suites {
Expand Down Expand Up @@ -527,7 +547,8 @@ impl OpenSSLServer {
.stderr(process::Stdio::null());
}

let child = subp.spawn()
let child = subp
.spawn()
.expect("cannot run openssl server");

let port_up = wait_for_port(self.port);
Expand All @@ -542,7 +563,11 @@ impl OpenSSLServer {
}

pub fn kill(&mut self) {
self.child.as_mut().unwrap().kill().unwrap();
self.child
.as_mut()
.unwrap()
.kill()
.unwrap();
self.child = None;
}

Expand Down Expand Up @@ -592,7 +617,9 @@ impl TlsServer {
http: false,
echo: false,
key: test_ca.join(keytype).join("end.key"),
certs: test_ca.join(keytype).join("end.fullchain"),
certs: test_ca
.join(keytype)
.join("end.fullchain"),
cafile: test_ca.join(keytype).join("ca.cert"),
verbose: false,
suites: Vec::new(),
Expand Down Expand Up @@ -722,7 +749,11 @@ impl TlsServer {
}

pub fn kill(&mut self) {
self.child.as_mut().unwrap().kill().unwrap();
self.child
.as_mut()
.unwrap()
.kill()
.unwrap();
self.child = None;
}

Expand Down Expand Up @@ -777,7 +808,8 @@ impl OpenSSLClient {
}

pub fn expect(&mut self, expect: &str) -> &mut Self {
self.expect_output.push(expect.to_string());
self.expect_output
.push(expect.to_string());
self
}

Expand Down Expand Up @@ -806,7 +838,8 @@ impl OpenSSLClient {
.arg(&self.cafile)
.args(&extra_args);

let output = subp.output()
let output = subp
.output()
.unwrap_or_else(|e| panic!("failed to execute: {}", e));

let stdout_str = unsafe { String::from_utf8_unchecked(output.stdout.clone()) };
Expand Down
Loading

4 comments on commit f5467c1

@thomwiggers
Copy link
Contributor

@thomwiggers thomwiggers commented on f5467c1 Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit says it was done with rustfmt 2.x, but I'm having trouble finding that version of rustfmt... There are a few references in the rustfmt repo, but those branches seem quite out-of-date.

What version was this done with? It might help with updating my experimental fork.

@ctz
Copy link
Member Author

@ctz ctz commented on f5467c1 Dec 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From memory, I built and installed rustfmt locally at v2.0.0-rc.2. AFAIK there isn't a crates.io version available.

@ctz
Copy link
Member Author

@ctz ctz commented on f5467c1 Dec 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once rustfmt v2 is released I'll be running rustfmt --check in CI to defend this

@thomwiggers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that version even compiled with current (nightly or stable) Rustc... That tag is from May.

Please sign in to comment.