Removed redundant code, improve performance

closes #10535
auto merge of #11547 : b1nd/rust/rust-doc, r=alexcrichton

closes #10535