Commit f15c817c authored by Steven Fackler's avatar Steven Fackler
Browse files

Rustfmt

parent 71a11470
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -59,9 +59,7 @@ impl Asn1StringRef {
    }

    pub fn len(&self) -> usize {
        unsafe {
            ffi::ASN1_STRING_length(self.as_ptr()) as usize
        }
        unsafe { ffi::ASN1_STRING_length(self.as_ptr()) as usize }
    }
}

+3 −13
Original line number Diff line number Diff line
@@ -365,22 +365,12 @@ impl BigNumRef {
    /// * `bits`: Length of the number in bits.
    /// * `msb`: The desired properties of the number.
    /// * `odd`: If `true`, the generated number will be odd.
    pub fn rand(&mut self,
                bits: i32,
                msb: MsbOption,
                odd: bool)
                -> Result<(), ErrorStack> {
        unsafe {
            cvt(ffi::BN_rand(self.as_ptr(), bits.into(), msb.0, odd as c_int)).map(|_| ())
        }
    pub fn rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> {
        unsafe { cvt(ffi::BN_rand(self.as_ptr(), bits.into(), msb.0, odd as c_int)).map(|_| ()) }
    }

    /// The cryptographically weak counterpart to `rand`.
    pub fn pseudo_rand(&mut self,
                       bits: i32,
                       msb: MsbOption,
                       odd: bool)
                       -> Result<(), ErrorStack> {
    pub fn pseudo_rand(&mut self, bits: i32, msb: MsbOption, odd: bool) -> Result<(), ErrorStack> {
        unsafe {
            cvt(ffi::BN_pseudo_rand(self.as_ptr(), bits.into(), msb.0, odd as c_int)).map(|_| ())
        }
+2 −5
Original line number Diff line number Diff line
@@ -215,9 +215,7 @@ fn get_dh() -> Result<Dh, ErrorStack> {
    use types::OpenSslType;

    // manually call into ffi to avoid forcing the features
    unsafe {
        cvt_p(ffi::DH_get_2048_256()).map(|p| Dh::from_ptr(p))
    }
    unsafe { cvt_p(ffi::DH_get_2048_256()).map(|p| Dh::from_ptr(p)) }
}

#[cfg(ossl101)]
@@ -302,8 +300,7 @@ mod verify {
        }
    }

    fn verify_subject_alt_names(domain: &str,
                                names: Stack<GeneralName>) -> bool {
    fn verify_subject_alt_names(domain: &str, names: Stack<GeneralName>) -> bool {
        let ip = domain.parse();

        for name in &names {
+7 −10
Original line number Diff line number Diff line
@@ -226,7 +226,8 @@ impl<'a, T: Stackable> iter::IntoIterator for &'a mut Stack<T> {

/// An iterator over the stack's contents.
pub struct Iter<'a, T: Stackable>
    where T: 'a {
    where T: 'a
{
    stack: &'a StackRef<T>,
    pos: usize,
}
@@ -251,8 +252,7 @@ impl<'a, T: Stackable> iter::Iterator for Iter<'a, T> {
    }
}

impl<'a, T: Stackable> iter::ExactSizeIterator for Iter<'a, T> {
}
impl<'a, T: Stackable> iter::ExactSizeIterator for Iter<'a, T> {}

/// A mutable iterator over the stack's contents.
pub struct IterMut<'a, T: Stackable + 'a> {
@@ -272,9 +272,7 @@ impl<'a, T: Stackable> iter::Iterator for IterMut<'a, T> {
            // guarantee that we won't return several references to
            // the same object, so we have to use unsafe code for
            // mutable iterators.
            let n = unsafe {
                Some(T::Ref::from_ptr_mut(self.stack._get(self.pos)))
            };
            let n = unsafe { Some(T::Ref::from_ptr_mut(self.stack._get(self.pos))) };

            self.pos += 1;

@@ -289,5 +287,4 @@ impl<'a, T: Stackable> iter::Iterator for IterMut<'a, T> {
    }
}

impl<'a, T: Stackable> iter::ExactSizeIterator for IterMut<'a, T> {
}
impl<'a, T: Stackable> iter::ExactSizeIterator for IterMut<'a, T> {}
+2 −3
Original line number Diff line number Diff line
@@ -513,9 +513,8 @@ impl<'a> Iterator for X509NameEntries<'a> {

    fn next(&mut self) -> Option<&'a X509NameEntryRef> {
        unsafe {
            self.loc = ffi::X509_NAME_get_index_by_NID(self.name.as_ptr(),
                                                       self.nid.as_raw(),
                                                       self.loc);
            self.loc =
                ffi::X509_NAME_get_index_by_NID(self.name.as_ptr(), self.nid.as_raw(), self.loc);

            if self.loc == -1 {
                return None;