Skip to content

Commit 4e9e27d

Browse files
committedOct 9, 2019
Add back many #[inline] behind a #[cfg]
1 parent 6d20b6b commit 4e9e27d

File tree

11 files changed

+304
-5
lines changed

11 files changed

+304
-5
lines changed
 

‎Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@ rustc-internal-api = []
4343
rustc-dep-of-std = ["nightly", "core", "compiler_builtins", "alloc", "rustc-internal-api"]
4444
raw = []
4545

46+
# Enables usage of `#[inline]` on far more functions than by default in this
47+
# crate. This may lead to a performance increase but often comes at a compile
48+
# time cost.
49+
inline-more = []
50+
4651
[package.metadata.docs.rs]
4752
features = ["nightly", "rayon", "serde", "raw"]

‎src/external_trait_impls/rayon/map.rs

+17
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub struct ParIter<'a, K, V, S> {
2222
impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParIter<'a, K, V, S> {
2323
type Item = (&'a K, &'a V);
2424

25+
#[cfg_attr(feature = "inline-more", inline)]
2526
fn drive_unindexed<C>(self, consumer: C) -> C::Result
2627
where
2728
C: UnindexedConsumer<Self::Item>,
@@ -38,6 +39,7 @@ impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParIter<'a, K, V, S> {
3839
}
3940

4041
impl<K, V, S> Clone for ParIter<'_, K, V, S> {
42+
#[cfg_attr(feature = "inline-more", inline)]
4143
fn clone(&self) -> Self {
4244
ParIter { map: self.map }
4345
}
@@ -63,6 +65,7 @@ pub struct ParKeys<'a, K, V, S> {
6365
impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParKeys<'a, K, V, S> {
6466
type Item = &'a K;
6567

68+
#[cfg_attr(feature = "inline-more", inline)]
6669
fn drive_unindexed<C>(self, consumer: C) -> C::Result
6770
where
6871
C: UnindexedConsumer<Self::Item>,
@@ -76,6 +79,7 @@ impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParKeys<'a, K, V, S> {
7679
}
7780

7881
impl<K, V, S> Clone for ParKeys<'_, K, V, S> {
82+
#[cfg_attr(feature = "inline-more", inline)]
7983
fn clone(&self) -> Self {
8084
ParKeys { map: self.map }
8185
}
@@ -101,6 +105,7 @@ pub struct ParValues<'a, K, V, S> {
101105
impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParValues<'a, K, V, S> {
102106
type Item = &'a V;
103107

108+
#[cfg_attr(feature = "inline-more", inline)]
104109
fn drive_unindexed<C>(self, consumer: C) -> C::Result
105110
where
106111
C: UnindexedConsumer<Self::Item>,
@@ -114,6 +119,7 @@ impl<'a, K: Sync, V: Sync, S: Sync> ParallelIterator for ParValues<'a, K, V, S>
114119
}
115120

116121
impl<K, V, S> Clone for ParValues<'_, K, V, S> {
122+
#[cfg_attr(feature = "inline-more", inline)]
117123
fn clone(&self) -> Self {
118124
ParValues { map: self.map }
119125
}
@@ -141,6 +147,7 @@ pub struct ParIterMut<'a, K, V, S> {
141147
impl<'a, K: Send + Sync, V: Send, S: Send> ParallelIterator for ParIterMut<'a, K, V, S> {
142148
type Item = (&'a K, &'a mut V);
143149

150+
#[cfg_attr(feature = "inline-more", inline)]
144151
fn drive_unindexed<C>(self, consumer: C) -> C::Result
145152
where
146153
C: UnindexedConsumer<Self::Item>,
@@ -178,6 +185,7 @@ pub struct ParValuesMut<'a, K, V, S> {
178185
impl<'a, K: Send, V: Send, S: Send> ParallelIterator for ParValuesMut<'a, K, V, S> {
179186
type Item = &'a mut V;
180187

188+
#[cfg_attr(feature = "inline-more", inline)]
181189
fn drive_unindexed<C>(self, consumer: C) -> C::Result
182190
where
183191
C: UnindexedConsumer<Self::Item>,
@@ -212,6 +220,7 @@ pub struct IntoParIter<K, V, S> {
212220
impl<K: Send, V: Send, S: Send> ParallelIterator for IntoParIter<K, V, S> {
213221
type Item = (K, V);
214222

223+
#[cfg_attr(feature = "inline-more", inline)]
215224
fn drive_unindexed<C>(self, consumer: C) -> C::Result
216225
where
217226
C: UnindexedConsumer<Self::Item>,
@@ -240,6 +249,7 @@ pub struct ParDrain<'a, K, V, S> {
240249
impl<K: Send, V: Send, S: Send> ParallelIterator for ParDrain<'_, K, V, S> {
241250
type Item = (K, V);
242251

252+
#[cfg_attr(feature = "inline-more", inline)]
243253
fn drive_unindexed<C>(self, consumer: C) -> C::Result
244254
where
245255
C: UnindexedConsumer<Self::Item>,
@@ -258,24 +268,28 @@ impl<K: fmt::Debug + Eq + Hash, V: fmt::Debug, S: BuildHasher> fmt::Debug
258268

259269
impl<K: Sync, V: Sync, S: Sync> HashMap<K, V, S> {
260270
/// Visits (potentially in parallel) immutably borrowed keys in an arbitrary order.
271+
#[cfg_attr(feature = "inline-more", inline)]
261272
pub fn par_keys(&self) -> ParKeys<'_, K, V, S> {
262273
ParKeys { map: self }
263274
}
264275

265276
/// Visits (potentially in parallel) immutably borrowed values in an arbitrary order.
277+
#[cfg_attr(feature = "inline-more", inline)]
266278
pub fn par_values(&self) -> ParValues<'_, K, V, S> {
267279
ParValues { map: self }
268280
}
269281
}
270282

271283
impl<K: Send, V: Send, S: Send> HashMap<K, V, S> {
272284
/// Visits (potentially in parallel) mutably borrowed values in an arbitrary order.
285+
#[cfg_attr(feature = "inline-more", inline)]
273286
pub fn par_values_mut(&mut self) -> ParValuesMut<'_, K, V, S> {
274287
ParValuesMut { map: self }
275288
}
276289

277290
/// Consumes (potentially in parallel) all values in an arbitrary order,
278291
/// while preserving the map's allocated memory for reuse.
292+
#[cfg_attr(feature = "inline-more", inline)]
279293
pub fn par_drain(&mut self) -> ParDrain<'_, K, V, S> {
280294
ParDrain { map: self }
281295
}
@@ -303,6 +317,7 @@ impl<K: Send, V: Send, S: Send> IntoParallelIterator for HashMap<K, V, S> {
303317
type Item = (K, V);
304318
type Iter = IntoParIter<K, V, S>;
305319

320+
#[cfg_attr(feature = "inline-more", inline)]
306321
fn into_par_iter(self) -> Self::Iter {
307322
IntoParIter { map: self }
308323
}
@@ -312,6 +327,7 @@ impl<'a, K: Sync, V: Sync, S: Sync> IntoParallelIterator for &'a HashMap<K, V, S
312327
type Item = (&'a K, &'a V);
313328
type Iter = ParIter<'a, K, V, S>;
314329

330+
#[cfg_attr(feature = "inline-more", inline)]
315331
fn into_par_iter(self) -> Self::Iter {
316332
ParIter { map: self }
317333
}
@@ -321,6 +337,7 @@ impl<'a, K: Send + Sync, V: Send, S: Send> IntoParallelIterator for &'a mut Hash
321337
type Item = (&'a K, &'a mut V);
322338
type Iter = ParIterMut<'a, K, V, S>;
323339

340+
#[cfg_attr(feature = "inline-more", inline)]
324341
fn into_par_iter(self) -> Self::Iter {
325342
ParIterMut { map: self }
326343
}

‎src/external_trait_impls/rayon/raw.rs

+11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct RawParIter<T> {
1818
impl<T> ParallelIterator for RawParIter<T> {
1919
type Item = Bucket<T>;
2020

21+
#[cfg_attr(feature = "inline-more", inline)]
2122
fn drive_unindexed<C>(self, consumer: C) -> C::Result
2223
where
2324
C: UnindexedConsumer<Self::Item>,
@@ -35,13 +36,15 @@ struct ParIterProducer<T> {
3536
impl<T> UnindexedProducer for ParIterProducer<T> {
3637
type Item = Bucket<T>;
3738

39+
#[cfg_attr(feature = "inline-more", inline)]
3840
fn split(self) -> (Self, Option<Self>) {
3941
let (left, right) = self.iter.split();
4042
let left = ParIterProducer { iter: left };
4143
let right = right.map(|right| ParIterProducer { iter: right });
4244
(left, right)
4345
}
4446

47+
#[cfg_attr(feature = "inline-more", inline)]
4548
fn fold_with<F>(self, folder: F) -> F
4649
where
4750
F: Folder<Self::Item>,
@@ -58,6 +61,7 @@ pub struct RawIntoParIter<T> {
5861
impl<T: Send> ParallelIterator for RawIntoParIter<T> {
5962
type Item = T;
6063

64+
#[cfg_attr(feature = "inline-more", inline)]
6165
fn drive_unindexed<C>(self, consumer: C) -> C::Result
6266
where
6367
C: UnindexedConsumer<Self::Item>,
@@ -88,6 +92,7 @@ unsafe impl<T> Send for RawParDrain<'_, T> {}
8892
impl<T: Send> ParallelIterator for RawParDrain<'_, T> {
8993
type Item = T;
9094

95+
#[cfg_attr(feature = "inline-more", inline)]
9196
fn drive_unindexed<C>(self, consumer: C) -> C::Result
9297
where
9398
C: UnindexedConsumer<Self::Item>,
@@ -118,6 +123,7 @@ struct ParDrainProducer<T> {
118123
impl<T: Send> UnindexedProducer for ParDrainProducer<T> {
119124
type Item = T;
120125

126+
#[cfg_attr(feature = "inline-more", inline)]
121127
fn split(self) -> (Self, Option<Self>) {
122128
let (left, right) = self.iter.clone().split();
123129
mem::forget(self);
@@ -126,6 +132,7 @@ impl<T: Send> UnindexedProducer for ParDrainProducer<T> {
126132
(left, right)
127133
}
128134

135+
#[cfg_attr(feature = "inline-more", inline)]
129136
fn fold_with<F>(mut self, mut folder: F) -> F
130137
where
131138
F: Folder<Self::Item>,
@@ -146,6 +153,7 @@ impl<T: Send> UnindexedProducer for ParDrainProducer<T> {
146153
}
147154

148155
impl<T> Drop for ParDrainProducer<T> {
156+
#[cfg_attr(feature = "inline-more", inline)]
149157
fn drop(&mut self) {
150158
// Drop all remaining elements
151159
if mem::needs_drop::<T>() {
@@ -160,19 +168,22 @@ impl<T> Drop for ParDrainProducer<T> {
160168

161169
impl<T> RawTable<T> {
162170
/// Returns a parallel iterator over the elements in a `RawTable`.
171+
#[cfg_attr(feature = "inline-more", inline)]
163172
pub fn par_iter(&self) -> RawParIter<T> {
164173
RawParIter {
165174
iter: unsafe { self.iter().iter },
166175
}
167176
}
168177

169178
/// Returns a parallel iterator over the elements in a `RawTable`.
179+
#[cfg_attr(feature = "inline-more", inline)]
170180
pub fn into_par_iter(self) -> RawIntoParIter<T> {
171181
RawIntoParIter { table: self }
172182
}
173183

174184
/// Returns a parallel iterator which consumes all elements of a `RawTable`
175185
/// without freeing its memory allocation.
186+
#[cfg_attr(feature = "inline-more", inline)]
176187
pub fn par_drain(&mut self) -> RawParDrain<'_, T> {
177188
RawParDrain {
178189
table: NonNull::from(self),

‎src/external_trait_impls/rayon/set.rs

+7
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,14 @@ where
214214
{
215215
/// Visits (potentially in parallel) the values representing the difference,
216216
/// i.e. the values that are in `self` but not in `other`.
217+
#[cfg_attr(feature = "inline-more", inline)]
217218
pub fn par_difference<'a>(&'a self, other: &'a Self) -> ParDifference<'a, T, S> {
218219
ParDifference { a: self, b: other }
219220
}
220221

221222
/// Visits (potentially in parallel) the values representing the symmetric
222223
/// difference, i.e. the values that are in `self` or in `other` but not in both.
224+
#[cfg_attr(feature = "inline-more", inline)]
223225
pub fn par_symmetric_difference<'a>(
224226
&'a self,
225227
other: &'a Self,
@@ -229,12 +231,14 @@ where
229231

230232
/// Visits (potentially in parallel) the values representing the
231233
/// intersection, i.e. the values that are both in `self` and `other`.
234+
#[cfg_attr(feature = "inline-more", inline)]
232235
pub fn par_intersection<'a>(&'a self, other: &'a Self) -> ParIntersection<'a, T, S> {
233236
ParIntersection { a: self, b: other }
234237
}
235238

236239
/// Visits (potentially in parallel) the values representing the union,
237240
/// i.e. all the values in `self` or `other`, without duplicates.
241+
#[cfg_attr(feature = "inline-more", inline)]
238242
pub fn par_union<'a>(&'a self, other: &'a Self) -> ParUnion<'a, T, S> {
239243
ParUnion { a: self, b: other }
240244
}
@@ -283,6 +287,7 @@ where
283287
{
284288
/// Consumes (potentially in parallel) all values in an arbitrary order,
285289
/// while preserving the set's allocated memory for reuse.
290+
#[cfg_attr(feature = "inline-more", inline)]
286291
pub fn par_drain(&mut self) -> ParDrain<'_, T, S> {
287292
ParDrain { set: self }
288293
}
@@ -292,6 +297,7 @@ impl<T: Send, S: Send> IntoParallelIterator for HashSet<T, S> {
292297
type Item = T;
293298
type Iter = IntoParIter<T, S>;
294299

300+
#[cfg_attr(feature = "inline-more", inline)]
295301
fn into_par_iter(self) -> Self::Iter {
296302
IntoParIter { set: self }
297303
}
@@ -301,6 +307,7 @@ impl<'a, T: Sync, S: Sync> IntoParallelIterator for &'a HashSet<T, S> {
301307
type Item = &'a T;
302308
type Iter = ParIter<'a, T, S>;
303309

310+
#[cfg_attr(feature = "inline-more", inline)]
304311
fn into_par_iter(self) -> Self::Iter {
305312
ParIter { set: self }
306313
}

‎src/external_trait_impls/serde.rs

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod size_hint {
44
/// This presumably exists to prevent denial of service attacks.
55
///
66
/// Original discussion: https://github.com/serde-rs/serde/issues/1114.
7+
#[cfg_attr(feature = "inline-more", inline)]
78
pub(super) fn cautious(hint: Option<usize>) -> usize {
89
cmp::min(hint.unwrap_or(0), 4096)
910
}
@@ -26,6 +27,7 @@ mod map {
2627
V: Serialize,
2728
H: BuildHasher,
2829
{
30+
#[cfg_attr(feature = "inline-more", inline)]
2931
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3032
where
3133
S: Serializer,
@@ -60,6 +62,7 @@ mod map {
6062
formatter.write_str("a map")
6163
}
6264

65+
#[cfg_attr(feature = "inline-more", inline)]
6366
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
6467
where
6568
A: MapAccess<'de>,
@@ -101,6 +104,7 @@ mod set {
101104
T: Serialize + Eq + Hash,
102105
H: BuildHasher,
103106
{
107+
#[cfg_attr(feature = "inline-more", inline)]
104108
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
105109
where
106110
S: Serializer,
@@ -133,6 +137,7 @@ mod set {
133137
formatter.write_str("a sequence")
134138
}
135139

140+
#[cfg_attr(feature = "inline-more", inline)]
136141
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
137142
where
138143
A: SeqAccess<'de>,
@@ -173,6 +178,7 @@ mod set {
173178
formatter.write_str("a sequence")
174179
}
175180

181+
#[cfg_attr(feature = "inline-more", inline)]
176182
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
177183
where
178184
A: SeqAccess<'de>,

‎src/map.rs

+111-4
Large diffs are not rendered by default.

‎src/raw/generic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl Group {
5555
/// a static variable to ensure the address is consistent across dylibs.
5656
///
5757
/// This is guaranteed to be aligned to the group size.
58+
#[inline]
5859
pub fn static_empty() -> &'static [u8] {
5960
union AlignedBytes {
6061
_align: Group,

‎src/raw/mod.rs

+64
Large diffs are not rendered by default.

‎src/rustc_entry.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ where
2929
/// assert_eq!(letters[&'u'], 1);
3030
/// assert_eq!(letters.get(&'y'), None);
3131
/// ```
32+
#[cfg_attr(feature = "inline-more", inline)]
3233
pub fn rustc_entry(&mut self, key: K) -> RustcEntry<'_, K, V> {
3334
let hash = make_hash(&self.hash_builder, &key);
3435
if let Some(elem) = self.table.find(hash, |q| q.0.eq(&key)) {
@@ -162,6 +163,7 @@ impl<'a, K, V> RustcEntry<'a, K, V> {
162163
/// *map.rustc_entry("poneyland").or_insert(10) *= 2;
163164
/// assert_eq!(map["poneyland"], 6);
164165
/// ```
166+
#[cfg_attr(feature = "inline-more", inline)]
165167
pub fn or_insert(self, default: V) -> &'a mut V
166168
where
167169
K: Hash,
@@ -187,6 +189,7 @@ impl<'a, K, V> RustcEntry<'a, K, V> {
187189
///
188190
/// assert_eq!(map["poneyland"], "hoho".to_string());
189191
/// ```
192+
#[cfg_attr(feature = "inline-more", inline)]
190193
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V
191194
where
192195
K: Hash,
@@ -207,6 +210,7 @@ impl<'a, K, V> RustcEntry<'a, K, V> {
207210
/// let mut map: HashMap<&str, u32> = HashMap::new();
208211
/// assert_eq!(map.rustc_entry("poneyland").key(), &"poneyland");
209212
/// ```
213+
#[cfg_attr(feature = "inline-more", inline)]
210214
pub fn key(&self) -> &K {
211215
match *self {
212216
Occupied(ref entry) => entry.key(),
@@ -234,6 +238,7 @@ impl<'a, K, V> RustcEntry<'a, K, V> {
234238
/// .or_insert(42);
235239
/// assert_eq!(map["poneyland"], 43);
236240
/// ```
241+
#[cfg_attr(feature = "inline-more", inline)]
237242
pub fn and_modify<F>(self, f: F) -> Self
238243
where
239244
F: FnOnce(&mut V),
@@ -264,6 +269,7 @@ impl<'a, K, V: Default> RustcEntry<'a, K, V> {
264269
/// assert_eq!(map["poneyland"], None);
265270
/// # }
266271
/// ```
272+
#[cfg_attr(feature = "inline-more", inline)]
267273
pub fn or_default(self) -> &'a mut V
268274
where
269275
K: Hash,
@@ -287,6 +293,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
287293
/// map.rustc_entry("poneyland").or_insert(12);
288294
/// assert_eq!(map.rustc_entry("poneyland").key(), &"poneyland");
289295
/// ```
296+
#[cfg_attr(feature = "inline-more", inline)]
290297
pub fn key(&self) -> &K {
291298
unsafe { &self.elem.as_ref().0 }
292299
}
@@ -309,6 +316,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
309316
///
310317
/// assert_eq!(map.contains_key("poneyland"), false);
311318
/// ```
319+
#[cfg_attr(feature = "inline-more", inline)]
312320
pub fn remove_entry(self) -> (K, V) {
313321
unsafe {
314322
self.table.erase_no_drop(&self.elem);
@@ -331,6 +339,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
331339
/// assert_eq!(o.get(), &12);
332340
/// }
333341
/// ```
342+
#[cfg_attr(feature = "inline-more", inline)]
334343
pub fn get(&self) -> &V {
335344
unsafe { &self.elem.as_ref().1 }
336345
}
@@ -362,6 +371,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
362371
///
363372
/// assert_eq!(map["poneyland"], 24);
364373
/// ```
374+
#[cfg_attr(feature = "inline-more", inline)]
365375
pub fn get_mut(&mut self) -> &mut V {
366376
unsafe { &mut self.elem.as_mut().1 }
367377
}
@@ -389,6 +399,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
389399
///
390400
/// assert_eq!(map["poneyland"], 22);
391401
/// ```
402+
#[cfg_attr(feature = "inline-more", inline)]
392403
pub fn into_mut(self) -> &'a mut V {
393404
unsafe { &mut self.elem.as_mut().1 }
394405
}
@@ -410,6 +421,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
410421
///
411422
/// assert_eq!(map["poneyland"], 15);
412423
/// ```
424+
#[cfg_attr(feature = "inline-more", inline)]
413425
pub fn insert(&mut self, mut value: V) -> V {
414426
let old_value = self.get_mut();
415427
mem::swap(&mut value, old_value);
@@ -433,6 +445,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
433445
///
434446
/// assert_eq!(map.contains_key("poneyland"), false);
435447
/// ```
448+
#[cfg_attr(feature = "inline-more", inline)]
436449
pub fn remove(self) -> V {
437450
self.remove_entry().1
438451
}
@@ -457,6 +470,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
457470
/// }
458471
///
459472
/// ```
473+
#[cfg_attr(feature = "inline-more", inline)]
460474
pub fn replace_entry(self, value: V) -> (K, V) {
461475
let entry = unsafe { self.elem.as_mut() };
462476

@@ -490,6 +504,7 @@ impl<'a, K, V> RustcOccupiedEntry<'a, K, V> {
490504
/// }
491505
/// }
492506
/// ```
507+
#[cfg_attr(feature = "inline-more", inline)]
493508
pub fn replace_key(self) -> K {
494509
let entry = unsafe { self.elem.as_mut() };
495510
mem::replace(&mut entry.0, self.key.unwrap())
@@ -508,6 +523,7 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
508523
/// let mut map: HashMap<&str, u32> = HashMap::new();
509524
/// assert_eq!(map.rustc_entry("poneyland").key(), &"poneyland");
510525
/// ```
526+
#[cfg_attr(feature = "inline-more", inline)]
511527
pub fn key(&self) -> &K {
512528
&self.key
513529
}
@@ -526,6 +542,7 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
526542
/// v.into_key();
527543
/// }
528544
/// ```
545+
#[cfg_attr(feature = "inline-more", inline)]
529546
pub fn into_key(self) -> K {
530547
self.key
531548
}
@@ -546,6 +563,7 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
546563
/// }
547564
/// assert_eq!(map["poneyland"], 37);
548565
/// ```
566+
#[cfg_attr(feature = "inline-more", inline)]
549567
pub fn insert(self, value: V) -> &'a mut V {
550568
let bucket = self.table.insert_no_grow(self.hash, (self.key, value));
551569
unsafe { &mut bucket.as_mut().1 }
@@ -567,7 +585,7 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
567585
/// assert_eq!(o.get(), &37);
568586
/// }
569587
/// ```
570-
#[inline]
588+
#[cfg_attr(feature = "inline-more", inline)]
571589
pub fn insert_entry(self, value: V) -> RustcOccupiedEntry<'a, K, V> {
572590
let bucket = self.table.insert_no_grow(self.hash, (self.key, value));
573591
RustcOccupiedEntry {
@@ -580,20 +598,23 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
580598

581599
impl<K, V> IterMut<'_, K, V> {
582600
/// Returns a iterator of references over the remaining items.
601+
#[cfg_attr(feature = "inline-more", inline)]
583602
pub fn rustc_iter(&self) -> Iter<'_, K, V> {
584603
self.iter()
585604
}
586605
}
587606

588607
impl<K, V> IntoIter<K, V> {
589608
/// Returns a iterator of references over the remaining items.
609+
#[cfg_attr(feature = "inline-more", inline)]
590610
pub fn rustc_iter(&self) -> Iter<'_, K, V> {
591611
self.iter()
592612
}
593613
}
594614

595615
impl<K, V> Drain<'_, K, V> {
596616
/// Returns a iterator of references over the remaining items.
617+
#[cfg_attr(feature = "inline-more", inline)]
597618
pub fn rustc_iter(&self) -> Iter<'_, K, V> {
598619
self.iter()
599620
}

‎src/scopeguard.rs

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ where
99
value: T,
1010
}
1111

12+
#[cfg_attr(feature = "inline-more", inline)]
1213
pub fn guard<T, F>(value: T, dropfn: F) -> ScopeGuard<T, F>
1314
where
1415
F: FnMut(&mut T),
@@ -21,6 +22,7 @@ where
2122
F: FnMut(&mut T),
2223
{
2324
type Target = T;
25+
#[cfg_attr(feature = "inline-more", inline)]
2426
fn deref(&self) -> &T {
2527
&self.value
2628
}
@@ -30,6 +32,7 @@ impl<T, F> DerefMut for ScopeGuard<T, F>
3032
where
3133
F: FnMut(&mut T),
3234
{
35+
#[cfg_attr(feature = "inline-more", inline)]
3336
fn deref_mut(&mut self) -> &mut T {
3437
&mut self.value
3538
}
@@ -39,6 +42,7 @@ impl<T, F> Drop for ScopeGuard<T, F>
3942
where
4043
F: FnMut(&mut T),
4144
{
45+
#[cfg_attr(feature = "inline-more", inline)]
4246
fn drop(&mut self) {
4347
(self.dropfn)(&mut self.value)
4448
}

‎src/set.rs

+56
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.