Rollup merge of #46128 - Coding-Doctors:patch-1, r=dtolnay
Rollup merge of #46128 - Coding-Doctors:patch-1, r=dtolnay

Fix doc tests for trim_right_matches

First pr, but isn't anything big so hopefully it should all be good.

graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust