mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Revamp the syntax to #[hard(a..b)] and #[soft(a..b)] bounds on node definitions (#4307)
* Revamp the syntax to #[hard(a..b)] and #[soft(a..b)] bounds on node definitions * Address review feedback: error on empty bounds ranges and remove redundant count clamps * Fix NaN transform from Repeat Array with a count of 1 * Remove redundant manual clamps already enforced by #[hard(...)] bounds
This commit is contained in:
@@ -424,7 +424,7 @@ fn string_repeat(
|
||||
string: String,
|
||||
/// The number of times the string should appear in the output.
|
||||
#[default(2)]
|
||||
#[hard_min(1)]
|
||||
#[hard(1..)]
|
||||
count: u32,
|
||||
/// The string placed between each repetition.
|
||||
#[default("\\n")]
|
||||
@@ -436,7 +436,7 @@ fn string_repeat(
|
||||
) -> String {
|
||||
let separator = if separator_escaping { unescape_string(separator) } else { separator };
|
||||
|
||||
let count = count.max(1) as usize;
|
||||
let count = count as usize;
|
||||
|
||||
let mut result = String::with_capacity((string.len() + separator.len()) * count);
|
||||
for i in 0..count {
|
||||
|
||||
Reference in New Issue
Block a user