summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index af2f994..b40abad 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,12 +14,14 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
+#![forbid(unsafe_code)]
+
//! Webserver helper for writing tests.
use std::convert::TryInto;
use std::io::Cursor;
use std::num::NonZeroU16;
-use std::str::from_utf8_unchecked;
+use std::str::from_utf8;
use std::sync::Arc;
use ar::Archive;
@@ -123,8 +125,7 @@ pub fn serve(archive: &'static str) -> Server {
current.as_mut().unwrap().next_entry()
{
let name = entry.header().identifier();
- // SAFETY: the input "file" is an &str already.
- let name = unsafe { from_utf8_unchecked(name) };
+ let name = from_utf8(name).unwrap();
size = entry.header().size() as usize;
if let Some(suffix) = name.strip_prefix(&part) {
// the suffix here isn't 'static, but we need