Coder Social home page Coder Social logo

Use `prettyplease` instead of `rustfmt` for the source code generated by `cargo component new --target` about cargo-component HOT 6 CLOSED

peterhuene avatar peterhuene commented on September 26, 2024
Use `prettyplease` instead of `rustfmt` for the source code generated by `cargo component new --target`

from cargo-component.

Comments (6)

sunfishcode avatar sunfishcode commented on September 26, 2024 1

@DougAnderson444 I encountered similar errors and submitted #247 to fix them.

from cargo-component.

peterhuene avatar peterhuene commented on September 26, 2024 1

I'll release a patch release shortly, but in the meantime I've posted a workaround to disable formatting of the bindings to the release notes of 0.9.0.

from cargo-component.

peterhuene avatar peterhuene commented on September 26, 2024

After implementing this, I discovered that prettyplease doesn't preserve whitespace (specifically new lines between items), which makes sense since it's going off of a syn::File.

That's relatively unimportant for something like bindings.rs, but more important for lib.rs.

Given that the code generated from the --target option is relatively uncomplicated, I think we can keep using rustfmt for now.

from cargo-component.

DougAnderson444 avatar DougAnderson444 commented on September 26, 2024

@peterhuene I am trying to migrate to v0.9.0 but I keep getting rustfmt errors on the libraries I am converting:

error[internal]: left behind trailing whitespace
   --> <stdin>:575:575:1
    |
575 |                         
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    |

error[internal]: left behind trailing whitespace
   --> <stdin>:599:599:1
    |
599 |                     
    | ^^^^^^^^^^^^^^^^^^^^
    |

error[internal]: left behind trailing whitespace
    --> <stdin>:1188:1188:1
     |
1188 |                     
     | ^^^^^^^^^^^^^^^^^^^^
     |
Full Log
left behind trailing whitespace
   --> <stdin>:575:575:1
    |
575 |                         
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    |

error[internal]: left behind trailing whitespace
   --> <stdin>:599:599:1
    |
599 |                     
    | ^^^^^^^^^^^^^^^^^^^^
    |

error[internal]: left behind trailing whitespace
    --> <stdin>:1188:1188:1
     |
1188 |                     
     | ^^^^^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1194:1194:1
     |
1194 |                 
     | ^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1200:1200:1
     |
1200 |             
     | ^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1240:1240:1
     |
1240 |                     
     | ^^^^^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1246:1246:1
     |
1246 |                 
     | ^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1263:1263:1
     |
1263 |                 
     | ^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1269:1269:1
     |
1269 |             
     | ^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1294:1294:1
     |
1294 |                 
     | ^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1300:1300:1
     |
1300 |             
     | ^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1312:1312:1
     |
1312 |             
     | ^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1892:1892:1
     |
1892 |                   
     | ^^^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1898:1898:1
     |
1898 |               
     | ^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:1904:1904:1
     |
1904 |           
     | ^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:2510:2510:1
     |
2510 |                 
     | ^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:2516:2516:1
     |
2516 |             
     | ^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:2522:2522:1
     |
2522 |         
     | ^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:3163:3163:1
     |
3163 |                   
     | ^^^^^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:3169:3169:1
     |
3169 |               
     | ^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:3175:3175:1
     |
3175 |           
     | ^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:3701:3701:1
     |
3701 |               
     | ^^^^^^^^^^^^^^
     |

error[internal]: left behind trailing whitespace
    --> <stdin>:3733:3733:1
     |
3733 |         
     | ^^^^^^^^
     |
blocking the migration.

This was the only relevant issue I found, but it doesn't look like it was implemented, was it? If not, any idea where this fmt issue is originating?

from cargo-component.

DougAnderson444 avatar DougAnderson444 commented on September 26, 2024

@sunfishcode so glad to not be alone! So does that mean we simply await a release patch then?

from cargo-component.

peterhuene avatar peterhuene commented on September 26, 2024

0.9.1 has now been released.

from cargo-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.