Skip to content

Commit b043aa6

Browse files
committed
Merge get_limit and get_limit_size.
Thanks to the previous commit, they no longer need to be separate.
1 parent 2fa8d0b commit b043aa6

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

compiler/rustc_middle/src/middle/limits.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,14 @@ fn get_limit(
5151
name: Symbol,
5252
default: Limit,
5353
) -> Limit {
54-
match get_limit_size(krate_attrs, sess, name) {
55-
Some(size) => Limit::new(size),
56-
None => default,
57-
}
58-
}
59-
60-
pub fn get_limit_size(
61-
krate_attrs: &[impl AttributeExt],
62-
sess: &Session,
63-
name: Symbol,
64-
) -> Option<usize> {
6554
for attr in krate_attrs {
6655
if !attr.has_name(name) {
6756
continue;
6857
}
6958

7059
if let Some(sym) = attr.value_str() {
7160
match sym.as_str().parse() {
72-
Ok(n) => return Some(n),
61+
Ok(n) => return Limit::new(n),
7362
Err(e) => {
7463
let error_str = match e.kind() {
7564
IntErrorKind::PosOverflow => "`limit` is too large",
@@ -90,5 +79,5 @@ pub fn get_limit_size(
9079
}
9180
}
9281
}
93-
None
82+
default
9483
}

0 commit comments

Comments
 (0)