From ee0384901784b2cbe8d62f259f8598cc0fc7d306 Mon Sep 17 00:00:00 2001 From: Graeme Coupar Date: Fri, 2 Apr 2021 14:00:56 +0100 Subject: Convert Into to From assist This adds a "Convert Into to From" assist, useful since clippy has recently started adding lints on every `Into`. It covers converting the signature, and converting any `self`/`Self` references within the body to the correct types. It does assume that every instance of `Into` can be converted to a `From`, which I _think_ is the case now. Let me know if there's something I'm not thinking of and I can try and make it smarter. --- crates/ide_db/src/helpers.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ide_db/src/helpers.rs') diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs index 9992a92bd..66798ea3a 100644 --- a/crates/ide_db/src/helpers.rs +++ b/crates/ide_db/src/helpers.rs @@ -93,6 +93,10 @@ impl FamousDefs<'_, '_> { self.find_trait("core:convert:From") } + pub fn core_convert_Into(&self) -> Option { + self.find_trait("core:convert:Into") + } + pub fn core_option_Option(&self) -> Option { self.find_enum("core:option:Option") } -- cgit v1.2.3