-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rinja #![no_std]
compatible
#286
Conversation
54cc1a9
to
95ee42d
Compare
percent-encoding = { version = "2.1.0", optional = true } | ||
serde = { version = "1.0", optional = true } | ||
serde_json = { version = "1.0", optional = true } | ||
percent-encoding = { version = "2.1.0", optional = true, default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One less dependency, yeay! \o/
/// Compare with [fmt](./fn.fmt.html). | ||
pub fn format() {} | ||
|
||
/// Replaces line breaks in plain text with appropriate HTML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a dot at the end of this sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the comments as they are in the current master, I just split the file in two. I think it's easier to follow the individual commits than looking at the whole diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a typo pass later on then. ;)
Ok(HtmlSafeOutput(linebreaks(try_to_str!(s => buffer)))) | ||
} | ||
|
||
/// Converts all newlines in a piece of plain text to HTML line breaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
Ok(HtmlSafeOutput(linebreaksbr(try_to_str!(s => buffer)))) | ||
} | ||
|
||
/// Replaces only paragraph breaks in plain text with appropriate HTML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm seeing a repeated behaviour here. 🤣
Well, I suppose it's not too important so stopping comments for this from here.
rinja/src/filters/alloc.rs
Outdated
Ok(output) | ||
} | ||
|
||
#[cfg(all(test, feature = "alloc"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can just be:
#[cfg(all(test, feature = "alloc"))] | |
#[cfg(test)] |
since this file is already imported only with #[cfg(feature = "alloc")]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. Replaced.
To make the next change more readable / easy to follow.
This leads to fewer needless allocations, and makes the operator `?` usable in an no-alloc context.
Looks good to me, thanks a lot! Just one thing I thought about: we should mention these feature in the book and the crate(s?) docs as well. |
Yes, I guess it would be a good idea to add an explanation what our features do. To a more seasoned rust developer, the feature |
Resolves #15.
alloc
-only environmentThe change is only so big because I split up the built-in filter implementation into two files: full no-std, and with alloc.