10546: feat: Implement promote_local_to_const assist r=Veykril a=Veykril

Fixes #7692, that is now one can invoke the `extract_variable` assist on something and then follow that up with this assist to turn it into a const.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-10-14 19:51:34 +00:00 committed by GitHub
commit 0af9d1fc8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 280 additions and 11 deletions

View file

@ -1307,6 +1307,10 @@ impl Function {
db.function_data(self.id).is_unsafe()
}
pub fn is_const(self, db: &dyn HirDatabase) -> bool {
db.function_data(self.id).is_const()
}
pub fn is_async(self, db: &dyn HirDatabase) -> bool {
db.function_data(self.id).is_async()
}