Skip to content

Dead code lint warns on types used in generics #11006

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

Closed
klutzy opened this issue Dec 16, 2013 · 1 comment · Fixed by #11009
Closed

Dead code lint warns on types used in generics #11006

klutzy opened this issue Dec 16, 2013 · 1 comment · Fixed by #11009

Comments

@klutzy
Copy link
Contributor

klutzy commented Dec 16, 2013

struct A;

fn f<T>() {}

fn main() {
    f::<A>();
    let _b = std::mem::size_of::<A>();
}
t.rs:1:0: 1:9 warning: code is never used: `A`, #[warn(dead_code)] on by default
t.rs:1 struct A;
       ^~~~~~~~~

cc @ktt3ja

@alexcrichton
Copy link
Member

Oh whoops, I should have caught this during review! @ktt3ja, this is because walk_ty doesn't recurse further when it sees ty_path (which may have type parameters like in this case), but the good news is now that we have a generic visit_path you should be able to delete the visit_ty method entirely.

@bors bors closed this as completed in ac137f6 Dec 18, 2013
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 7, 2023
…red-rendering, r=Veykril

internal: Defer structured snippet rendering to allow escaping snippet bits

Since we know exactly where snippets are, we can transparently escape snippet bits to the exact text edits that need it, and not have to do it for anything other text edits.

Also will eventually fix rust-lang#11006 once all assists are migrated. This comes as a side-effect of text edits that don't have snippets get marked as having no insert formatting at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants