-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[do not merge] Relicensing rewrite #3251
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fffcd09
relicensing: Remove fn_to_numeric_cast, fn_to_numeric_cast_with_trunc…
Manishearth 057243f
relicensing: Remove map_clone
Manishearth b36bb0a
Reimplement the `map_clone` lint from scratch
oli-obk 696dc36
FIx dogfood
oli-obk 913a5c9
Trailing newline
oli-obk f422721
Reimplement the `fn_to_numeric_cast` lint
phansch 7adf24e
Improve docs of fn_to_numeric_cast
phansch c0ab8b2
Reimplement the `fn_to_numeric_cast_with_truncation` lint
phansch 391d53d
Add hidden lifetime parameters to fix warning
phansch 8b3d207
Only run tests if pointer width is 64bit
phansch 1544a1a
Merge remote-tracking branch 'origin/master' into relicense-rewrite
phansch 8407957
Fix fn_to_numeric_cast UI tests
phansch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#![feature(tool_lints)] | ||
|
||
#[warn(clippy::fn_to_numeric_cast)] | ||
|
||
fn foo() -> String { String::new() } | ||
|
||
fn test_function_to_numeric_cast() { | ||
let _ = foo as i8; | ||
let _ = foo as i16; | ||
let _ = foo as i32; | ||
let _ = foo as i64; | ||
let _ = foo as i128; | ||
let _ = foo as isize; | ||
|
||
let _ = foo as u8; | ||
let _ = foo as u16; | ||
let _ = foo as u32; | ||
let _ = foo as u64; | ||
let _ = foo as u128; | ||
|
||
// Casting to usize is OK and should not warn | ||
let _ = foo as usize; | ||
} | ||
|
||
fn test_function_var_to_numeric_cast() { | ||
let abc: fn() -> String = foo; | ||
|
||
let _ = abc as i8; | ||
let _ = abc as i16; | ||
let _ = abc as i32; | ||
let _ = abc as i64; | ||
let _ = abc as i128; | ||
let _ = abc as isize; | ||
|
||
let _ = abc as u8; | ||
let _ = abc as u16; | ||
let _ = abc as u32; | ||
let _ = abc as u64; | ||
let _ = abc as u128; | ||
|
||
// Casting to usize is OK and should not warn | ||
let _ = abc as usize; | ||
} | ||
|
||
fn fn_with_fn_args(f: fn(i32) -> i32) -> i32 { | ||
f as i32 | ||
} | ||
|
||
fn main() {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[warn()]
->#![warn()]