Вы можете пометить функцию как устарела :
// Consider summarizing this and linking to the docs, rather than putting the
// entire message here.
#[deprecated(note=
"**Using this function is a mistake.**
This function is slow,
since checking widgets is an extremely expensive operation.
You should be keeping track of what's what, and ideally will
never need to use this function.
If you _do_ need to use this function, please consider a refactor.")]
pub fn test_widget(foo: String) -> bool {
/// Check whether foo is a metasyntactic variable.
false
}
Если пользователь использует функцию, он получает предупреждение:
warning: use of deprecated item 'test_widget': **Using this function is a mistake.**
This function is slow,
since checking widgets is an extremely expensive operation.
You should be keeping track of what's what, and ideally will
never need to use this function.
If you _do_ need to use this function, please consider a refactor.
Но он можетвыключите его с помощью #[allow(deprecated)]
:
#[allow(deprecated)]
test_widget("Hello, World!".to_string()); // no warning
Ссылка на игровую площадку.