Single line if (without else) statement #6369
              
                Unanswered
              
          
                  
                    
                      Cationiz3r
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all, I was working on a project of mine when I found that
rustfmtwas always expanding shortifstatements.For example, I have a function that adds cached items into a redis server, which would always fail if the items list is empty, so the following code snippet is used:
However, by default,
rustfmtalways expand it to:which takes 2 extra lines.
Is there an option I can use to compact it into the first snippet?
Beta Was this translation helpful? Give feedback.
All reactions