Skip to content

Commit

Permalink
Fix duplicated is_empty test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucretiel committed Sep 16, 2022
1 parent 4558498 commit 2016989
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/yew/src/html/classes.rs
Expand Up @@ -73,8 +73,8 @@ impl Classes {
/// # Safety
///
/// This function will not split the string into multiple classes. Please do not use it unless
/// you are absolutely certain that the string does not contain any whitespace. Using `push()`
/// is preferred.
/// you are absolutely certain that the string does not contain any whitespace and it is not
/// empty. Using `push()` is preferred.
pub unsafe fn unchecked_push<T: Into<Cow<'static, str>>>(&mut self, class: T) {
self.set.insert(class.into());
}
Expand Down Expand Up @@ -178,7 +178,7 @@ impl From<&'static str> for Classes {

impl From<String> for Classes {
fn from(t: String) -> Self {
match t.contains(|c: char| c.is_whitespace()) && !t.is_empty() {
match t.contains(|c: char| c.is_whitespace()) {
// If the string only contains a single class, we can just use it
// directly (rather than cloning it into a new string). Need to make
// sure it's not empty, though.
Expand Down

0 comments on commit 2016989

Please sign in to comment.