-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Option<*T>
should be represented as a pointer
#10570
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
Comments
Put another way, this test should pass:
|
As mentioned in #10571, this depends on |
Not sure if this is related, but we are also having difficulties with
|
Function pointers should already be non-nullable (and thus an That could be changed without too much trouble, I think, but it probably ought to be a separate issue. |
Closing because #10571 was closed as well. |
…, r=xFrednet Add redundant type annotations lint Hello, I'm trying to add the `redundat_type_annotations` lint. It's still WIP but I'd like to start gathering some feedbacks to be sure that I'm not doing things 100% wrong :) Right now it still misses lints like: - [x] `let foo: u32 = 5_u32`, - [x] `let foo: String = STest2::func()` - [x] `let foo: String = self.func()` (`MethodCall`) - [x] refs - [ ] Generics I've some problems regarding the second example above, in the `init` part of the `Local` I have: ```rust init: Some( Expr { hir_id: HirId(DefId(0:24 ~ playground[e1bd]::main).58), kind: Call( Expr { hir_id: HirId(DefId(0:24 ~ playground[e1bd]::main).59), kind: Path( TypeRelative( Ty { hir_id: HirId(DefId(0:24 ~ playground[e1bd]::main).61), kind: Path( Resolved( None, Path { span: src/main.rs:77:21: 77:27 (#0), res: Def( Struct, DefId(0:17 ~ playground[e1bd]::STest2), ), segments: [ PathSegment { ident: STest2#0, hir_id: HirId(DefId(0:24 ~ playground[e1bd]::main).60), res: Def( Struct, DefId(0:17 ~ playground[e1bd]::STest2), ), args: None, infer_args: true, }, ], }, ), ), span: src/main.rs:77:21: 77:27 (#0), }, PathSegment { ident: get_numb#0, hir_id: HirId(DefId(0:24 ~ playground[e1bd]::main).62), res: Err, args: None, infer_args: true, }, ), ), span: src/main.rs:77:21: 77:37 (#0), }, [], ), span: src/main.rs:77:21: 77:39 (#0), }, ), ``` And I'm not sure how to get the return type of the function `STest2::func()` since the resolved path `DefId` points to the struct itself and not the function. Do you have any idea on how I could get this information in this case? Thanks! changelog: changelog: [`redundant_type_annotations`]: New lint to warn on redundant type annotations fixes rust-lang#9155
Just like
Option<~T>
andOption<&T>
.cc @jld
The text was updated successfully, but these errors were encountered: