Giter Site home page Giter Site logo

Ensure "unsafe" counts about cargo-count HOT 4 CLOSED

kbknapp avatar kbknapp commented on July 18, 2024
Ensure "unsafe" counts

from cargo-count.

Comments (4)

azerupi avatar azerupi commented on July 18, 2024

unsafe is not always followed by brackets. Example from the nomicon:

unsafe impl<T: Send> Send for Unique<T> {}

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

Yep, the actual regex doesn't assume that it will be. In fact, the goal is mark and count the entire function as unsafe when used to mark a function and not a block.

I have a stash locally that I'm working on with a far more accurate regex and counting function, but it isn't 100% correct....so if you have a solution I'm all ears ;)

from cargo-count.

azerupi avatar azerupi commented on July 18, 2024

Ah sorry, from the issue I assumed that it only matched blocks. My bad :)

If I had no exams I would have tried to help more but until end august I am
a bit in a rush ;)
On Aug 22, 2015 6:52 AM, "Kevin K." [email protected] wrote:

Yep, the actual regex doesn't assume that it will be. In fact, the goal is
mark and count the entire function as unsafe when used to mark a function
and not a block.

I have a stash locally that I'm working on with a far more accurate regex
and counting function, but it isn't 100% correct....so if you have a
solution I'm all ears ;)


Reply to this email directly or view it on GitHub
#5 (comment).

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

No worries! :)

After going through my latest Rust checkout (which I'll use as my "official" guide for correctness on this issue) with some crazy grepping I've found 2861 lines that I believe are valid unsafe lines. What I don't know is how many of those lines are inside of /* block comments */ which will get ruled out by the counting function....but let's just say 2861 for the sake of argument.

Since a large majority of those lines are actually starting unsafe blocks, cargo-count should probably have a significant number above that.

from cargo-count.

Related Issues (18)

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.