fix indexing_slicing and unwrap warnings

since this gets a slice both by using get_mut
with unwrap, and just directly getting a reference
to a slice, make them both use get and unwrap
and fix both clippy warnings.

Change-Id: I5a7870a342ae7dd9d41fbae1afbb70cc44df98c0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/72588
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
diff --git a/rust/bssl-crypto/src/hkdf.rs b/rust/bssl-crypto/src/hkdf.rs
index 532468f..f1cc2ea 100644
--- a/rust/bssl-crypto/src/hkdf.rs
+++ b/rust/bssl-crypto/src/hkdf.rs
@@ -185,7 +185,9 @@
     evp_md: *const bssl_sys::EVP_MD,
 }
 
-#[allow(clippy::let_unit_value)]
+#[allow(clippy::let_unit_value,
+        clippy::unwrap_used,
+)]
 impl Prk {
     /// Creates a Prk from bytes.
     pub fn new<MD: digest::Algorithm>(prk_bytes: &[u8]) -> Option<Self> {
@@ -209,9 +211,10 @@
 
     /// Returns the bytes of the pseudorandom key.
     pub fn as_bytes(&self) -> &[u8] {
-        // `self.len` must be less than the length of `self.prk` thus
+        self.prk.get(..self.len)
+        // unwrap:`self.len` must be less than the length of `self.prk` thus
         // this is always in bounds.
-        &self.prk[..self.len]
+        .unwrap()
     }
 
     /// Derive key material for the given info parameter. Attempting