rustdoc: Prune the paths that do not appear in the index.

`allPaths` entries in `search-index.js` are only meaningful when there are `searchIndex` items that refer to them. Pruning unused paths gives a substantial gain in the search index size, especially when both the library docs and compiler docs are generated altogether:

```
 1719473 search-index-old.js
 1503299 search-index.js (13% gain)

  262711 search-index-old.js.gz
  214205 search-index.js.gz (18.5% gain)
```

...where `*.gz` files are gzipped with `gzip -9`. This commit also cleans the `initSearch` JavaScript routine a bit.