Skip to content

Commit

Permalink
Remove build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianmarco Garrisi committed Feb 25, 2024
1 parent 3811488 commit 12cad90
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 39 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ categories = ["data-structures", "algorithms"]
license = "LGPL-3.0 OR MPL-2.0"
edition = "2021"

build = "build.rs"

[build-dependencies]
autocfg = "1"

Expand Down
7 changes: 0 additions & 7 deletions build.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/core_iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!
//! Usually you don't need to explicitly `use` any of the types declared here.
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub(crate) mod std {
pub use core::*;
pub use ::alloc::vec;
Expand Down
12 changes: 6 additions & 6 deletions src/double_priority_queue/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
//!
//! Usually you don't need to explicitly `use` any of the types declared here.
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub(crate) mod std {
pub use core::*;
pub use ::alloc::vec;
}

use core::hash::BuildHasher;
use std::cmp::{Eq, Ord};
#[cfg(has_std)]
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState;
use std::hash::Hash;
use std::iter::*;
Expand All @@ -47,7 +47,7 @@ use crate::DoublePriorityQueue;
///
/// The item is mutable too, but it is a logical error to modify it in a way that
/// changes the result of any of `hash` or `eq`.
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct IterMut<'a, I: 'a, P: 'a, H: 'a = RandomState>
where
I: Hash + Eq,
Expand All @@ -57,7 +57,7 @@ where
pos: usize,
}

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct IterMut<'a, I: 'a, P: 'a, H: 'a>
where
I: Hash + Eq,
Expand Down Expand Up @@ -116,7 +116,7 @@ where
/// Since it implements [`DoubleEndedIterator`], this iterator can be reversed at any time
/// calling `rev`, at which point, elements will be extracted from the one with maximum priority
/// to the one with minimum priority.
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct IntoSortedIter<I, P, H = RandomState>
where
I: Hash + Eq,
Expand All @@ -125,7 +125,7 @@ where
pub(crate) pq: DoublePriorityQueue<I, P, H>,
}

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct IntoSortedIter<I, P, H>
where
I: Hash + Eq,
Expand Down
10 changes: 5 additions & 5 deletions src/double_priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
pub mod iterators;

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
use std::vec::Vec;

use crate::core_iterators::{IntoIter, Iter};
Expand All @@ -32,7 +32,7 @@ use iterators::*;

use std::borrow::Borrow;
use std::cmp::{Eq, Ord};
#[cfg(has_std)]
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState;
use std::hash::{BuildHasher, Hash};
use std::iter::{Extend, FromIterator, IntoIterator, Iterator};
Expand Down Expand Up @@ -79,7 +79,7 @@ use std::mem::replace;
/// }
/// ```
#[derive(Clone)]
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct DoublePriorityQueue<I, P, H = RandomState>
where
I: Hash + Eq,
Expand All @@ -89,7 +89,7 @@ where
}

#[derive(Clone)]
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct DoublePriorityQueue<I, P, H>
where
I: Hash + Eq,
Expand Down Expand Up @@ -118,7 +118,7 @@ where
}
}

#[cfg(has_std)]
#[cfg(feature = "std")]
impl<I, P> DoublePriorityQueue<I, P>
where
P: Ord,
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
//! println!("{}", item);
//! }
//! ```
#![cfg_attr(not(has_std), no_std)]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
extern crate alloc;

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub(crate) mod std {
pub use core::*;
}
Expand Down
12 changes: 6 additions & 6 deletions src/priority_queue/iterators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
//!
//! Usually you don't need to explicitly `use` any of the types declared here.
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub(crate) mod std {
pub use core::*;
pub use ::alloc::vec;
}

use core::hash::BuildHasher;
use std::cmp::{Eq, Ord};
#[cfg(has_std)]
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState;
use std::hash::Hash;
use std::iter::*;
Expand All @@ -47,7 +47,7 @@ use crate::PriorityQueue;
///
/// The item is mutable too, but it is a logical error to modify it in a way that
/// changes the result of any of `hash` or `eq`.
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct IterMut<'a, I: 'a, P: 'a, H: 'a = RandomState>
where
I: Hash + Eq,
Expand All @@ -57,7 +57,7 @@ where
pos: usize,
}

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct IterMut<'a, I: 'a, P: 'a, H: 'a>
where
I: Hash + Eq,
Expand Down Expand Up @@ -113,7 +113,7 @@ where
/// ordered by priority, from the highest to the lowest.
///
/// It can be obtained calling the `into_sorted_iter` method.
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct IntoSortedIter<I, P, H = RandomState>
where
I: Hash + Eq,
Expand All @@ -122,7 +122,7 @@ where
pub(crate) pq: PriorityQueue<I, P, H>,
}

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct IntoSortedIter<I, P, H>
where
I: Hash + Eq,
Expand Down
10 changes: 5 additions & 5 deletions src/priority_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pub mod iterators;

#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
use std::vec::Vec;

use crate::core_iterators::{IntoIter, Iter};
Expand All @@ -33,7 +33,7 @@ use iterators::*;

use std::borrow::Borrow;
use std::cmp::{Eq, Ord};
#[cfg(has_std)]
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState;
use std::hash::{BuildHasher, Hash};
use std::iter::{Extend, FromIterator, IntoIterator, Iterator};
Expand Down Expand Up @@ -70,7 +70,7 @@ use std::mem::replace;
/// }
/// ```
#[derive(Clone, Debug)]
#[cfg(has_std)]
#[cfg(feature = "std")]
pub struct PriorityQueue<I, P, H = RandomState>
where
I: Hash + Eq,
Expand All @@ -80,7 +80,7 @@ where
}

#[derive(Clone, Debug)]
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub struct PriorityQueue<I, P, H>
where
I: Hash + Eq,
Expand Down Expand Up @@ -109,7 +109,7 @@ where
}
}

#[cfg(has_std)]
#[cfg(feature = "std")]
impl<I, P> PriorityQueue<I, P>
where
P: Ord,
Expand Down
8 changes: 4 additions & 4 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
use std::vec::Vec;

// an improvement in terms of complexity would be to use a bare HashMap
Expand All @@ -26,7 +26,7 @@ use crate::core_iterators::*;

use std::borrow::Borrow;
use std::cmp::{Eq, Ord};
#[cfg(has_std)]
#[cfg(feature = "std")]
use std::collections::hash_map::RandomState;
use std::hash::{BuildHasher, Hash};
use std::iter::{FromIterator, IntoIterator, Iterator};
Expand All @@ -43,7 +43,7 @@ pub(crate) struct Position(pub usize);

/// Internal storage of PriorityQueue and DoublePriorityQueue
#[derive(Clone)]
#[cfg(has_std)]
#[cfg(feature = "std")]
pub(crate) struct Store<I, P, H = RandomState>
where
I: Hash + Eq,
Expand All @@ -57,7 +57,7 @@ where
}

#[derive(Clone)]
#[cfg(not(has_std))]
#[cfg(not(feature = "std"))]
pub(crate) struct Store<I, P, H>
where
I: Hash + Eq,
Expand Down

0 comments on commit 12cad90

Please sign in to comment.