From 9db970ee082e315cfa04db163fe2e0268b618531 Mon Sep 17 00:00:00 2001 From: lbrande Date: Mon, 22 Feb 2021 16:23:42 +0100 Subject: De Morgan's Law assist now correctly inverts <, <=, >, >=. --- crates/ide_db/src/helpers.rs | 4 ++++ crates/ide_db/src/helpers/famous_defs_fixture.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'crates/ide_db') diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs index bc7aee110..f9de8ce0e 100644 --- a/crates/ide_db/src/helpers.rs +++ b/crates/ide_db/src/helpers.rs @@ -45,6 +45,10 @@ impl FamousDefs<'_, '_> { self.find_crate("core") } + pub fn core_cmp_Ord(&self) -> Option { + self.find_trait("core:cmp:Ord") + } + pub fn core_convert_From(&self) -> Option { self.find_trait("core:convert:From") } diff --git a/crates/ide_db/src/helpers/famous_defs_fixture.rs b/crates/ide_db/src/helpers/famous_defs_fixture.rs index 5e88de64d..bb4e9666b 100644 --- a/crates/ide_db/src/helpers/famous_defs_fixture.rs +++ b/crates/ide_db/src/helpers/famous_defs_fixture.rs @@ -1,5 +1,15 @@ //- /libcore.rs crate:core //! Signatures of traits, types and functions from the core lib for use in tests. +pub mod cmp { + + pub trait Ord { + fn cmp(&self, other: &Self) -> Ordering; + fn max(self, other: Self) -> Self; + fn min(self, other: Self) -> Self; + fn clamp(self, min: Self, max: Self) -> Self; + } +} + pub mod convert { pub trait From { fn from(t: T) -> Self; @@ -109,6 +119,7 @@ pub mod option { pub mod prelude { pub use crate::{ + cmp::Ord, convert::From, default::Default, iter::{IntoIterator, Iterator}, -- cgit v1.2.3