Fix a few mutable types for `self` parameters.

This commit is contained in:
Corey Farwell 2016-06-02 00:05:57 -04:00
parent 49db4c84df
commit f4f6412fcb
3 changed files with 7 additions and 7 deletions

View File

@ -81,7 +81,7 @@ mod tests {
#[test] #[test]
#[cfg(feature = "rfc5114")] #[cfg(feature = "rfc5114")]
fn test_dh_rfc5114() { fn test_dh_rfc5114() {
let ctx = SslContext::new(Sslv23).unwrap(); let mut ctx = SslContext::new(Sslv23).unwrap();
let dh1 = DH::get_1024_160().unwrap(); let dh1 = DH::get_1024_160().unwrap();
ctx.set_tmp_dh(dh1).unwrap(); ctx.set_tmp_dh(dh1).unwrap();
let dh2 = DH::get_2048_224().unwrap(); let dh2 = DH::get_2048_224().unwrap();
@ -92,7 +92,7 @@ mod tests {
#[test] #[test]
fn test_dh() { fn test_dh() {
let ctx = SslContext::new(Sslv23).unwrap(); let mut ctx = SslContext::new(Sslv23).unwrap();
let p = BigNum::from_hex_str("87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F25D2CEED4435\ let p = BigNum::from_hex_str("87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F25D2CEED4435\
E3B00E00DF8F1D61957D4FAF7DF4561B2AA3016C3D91134096FAA3BF429\ E3B00E00DF8F1D61957D4FAF7DF4561B2AA3016C3D91134096FAA3BF429\
6D830E9A7C209E0C6497517ABD5A8A9D306BCF67ED91F9E6725B4758C02\ 6D830E9A7C209E0C6497517ABD5A8A9D306BCF67ED91F9E6725B4758C02\
@ -122,7 +122,7 @@ mod tests {
#[test] #[test]
fn test_dh_from_pem() { fn test_dh_from_pem() {
let ctx = SslContext::new(Sslv23).unwrap(); let mut ctx = SslContext::new(Sslv23).unwrap();
let pem_path = Path::new("test/dhparams.pem"); let pem_path = Path::new("test/dhparams.pem");
let mut file = File::open(&pem_path) let mut file = File::open(&pem_path)
.ok() .ok()

View File

@ -521,13 +521,13 @@ impl SslContext {
} }
} }
pub fn set_read_ahead(&self, m: u32) { pub fn set_read_ahead(&mut self, m: u32) {
unsafe { unsafe {
ffi_extras::SSL_CTX_set_read_ahead(self.ctx, m as c_long); ffi_extras::SSL_CTX_set_read_ahead(self.ctx, m as c_long);
} }
} }
pub fn set_tmp_dh(&self, dh: DH) -> Result<(), ErrorStack> { pub fn set_tmp_dh(&mut self, dh: DH) -> Result<(), ErrorStack> {
wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_tmp_dh(self.ctx, dh.raw()) as i32 }) wrap_ssl_result(unsafe { ffi_extras::SSL_CTX_set_tmp_dh(self.ctx, dh.raw()) as i32 })
} }
@ -647,7 +647,7 @@ impl SslContext {
SslContextOptions::from_bits(ret).unwrap() SslContextOptions::from_bits(ret).unwrap()
} }
pub fn options(&mut self) -> SslContextOptions { pub fn options(&self) -> SslContextOptions {
let ret = unsafe { ffi_extras::SSL_CTX_get_options(self.ctx) }; let ret = unsafe { ffi_extras::SSL_CTX_get_options(self.ctx) };
SslContextOptions::from_bits(ret).unwrap() SslContextOptions::from_bits(ret).unwrap()
} }

View File

@ -437,7 +437,7 @@ fn test_set_certificate_and_private_key() {
} }
run_test!(get_ctx_options, |method, _| { run_test!(get_ctx_options, |method, _| {
let mut ctx = SslContext::new(method).unwrap(); let ctx = SslContext::new(method).unwrap();
ctx.options(); ctx.options();
}); });