Repository: mgeisler/textwrap (language: rust)

Issue:
Forbid unsafe code
`textwrap` does not seem to use unsafe code, which is very good :)

To prevent this from ever happening, add following line to the top:
```rust
#![forbid(unsafe_code)]
```
of https://github.com/mgeisler/textwrap/blob/master/src/lib.rs

This will make the package green in 
https://github.com/rust-secure-code/cargo-geiger



Discussion / hints:
Hey @ralpha, I'm actually considering introducing a function that will use a bit of unsafe code to cheaply wrap a string inplace (as discussed in #166. Such a line would then need to go.

If a dependency has both safe and unsafe functions, can `cargo geiger` then tell me if I only call code in the safe subset of my dependencies? Or is a dependency flagged as "safe" or "unsafe" as a whole?
`cargo geiger` will tell you how many unsafe code is in the repo and how many is called. Currently this is how it is shown in my dependencies: (I use `textwrap` because of `clap`)
```
Functions  Expressions  Impls  Traits  Methods  Dependency
0/0        0/0          0/0    0/0     0/0      ?      │   ├── textwrap 0.11.0
0/0        0/0          0/0    0/0     0/0      ?      │   │   └── unicode-width 0.1.8
```
Here you can see a dependencies with unsafe code:
```
1/1        16/28        0/0    0/0     0/2      !  │   │   ├── log 0.4.11
```
It tells me:
Metric output format: x/y
    x = unsafe code used by the build
    y = total unsafe code found in the crate

Note that you have to be sure you NEED to use unsafe!
Looking at the issue it looks like this can be done using safe code and there is not a need for unsafe here.
I'm not familiar with the code-base but this is my guess.
If you have questions open an issue here: https://github.com/rust-secure-code/safety-dance/
Someone might be able to help you not needing unsafe code.

If you REALLY need unsafe but only in some cases you could add it under a feature flag, so it is opt-in.
Some more info about unsafe in general: https://www.youtube.com/watch?v=QAz-maaH0KM
If you do at unsafe code, please add a [fuzzer](https://github.com/rust-secure-code/projects#fuzzers) too to check the unsafe code and write some tests for it. This makes sure you don't introduce memory bugs (now or in the future).

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index a674725f..a59e6d8d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -89,6 +89,7 @@
 //! [`WordSplitter`]: trait.WordSplitter.html
 
 #![doc(html_root_url = "https://docs.rs/textwrap/0.12.1")]
+#![forbid(unsafe_code)] // See https://github.com/mgeisler/textwrap/issues/210
 #![deny(missing_docs)]
 #![deny(missing_debug_implementations)]
 #![allow(clippy::redundant_field_names)]


Test patch: