Skip to content

Commit 38dd569

Browse files
committed
Auto merge of rust-lang#124377 - matthiaskrgr:rollup-ajxjq35, r=matthiaskrgr
Rollup of 2 pull requests Successful merges: - rust-lang#124287 (Improved code with clippy) - rust-lang#124326 (tests: remove few ignore-stage2) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9e6c4fd + c125e9d commit 38dd569

13 files changed

+20
-28
lines changed

compiler/rustc_lexer/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ impl Cursor<'_> {
630630
// with a number
631631
self.bump();
632632
let mut empty_exponent = false;
633-
if self.first().is_digit(10) {
633+
if self.first().is_ascii_digit() {
634634
self.eat_decimal_digits();
635635
match self.first() {
636636
'e' | 'E' => {
@@ -661,7 +661,7 @@ impl Cursor<'_> {
661661
// If the first symbol is valid for identifier, it can be a lifetime.
662662
// Also check if it's a number for a better error reporting (so '0 will
663663
// be reported as invalid lifetime and not as unterminated char literal).
664-
is_id_start(self.first()) || self.first().is_digit(10)
664+
is_id_start(self.first()) || self.first().is_ascii_digit()
665665
};
666666

667667
if !can_be_a_lifetime {
@@ -677,7 +677,7 @@ impl Cursor<'_> {
677677
// Either a lifetime or a character literal with
678678
// length greater than 1.
679679

680-
let starts_with_number = self.first().is_digit(10);
680+
let starts_with_number = self.first().is_ascii_digit();
681681

682682
// Skip the literal contents.
683683
// First symbol can be a number (which isn't a valid identifier start),

compiler/rustc_lexer/src/unescape.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn scan_escape<T: From<char> + From<u8>>(
259259
} else {
260260
// This may be a high byte, but that will only happen if `T` is
261261
// `MixedUnit`, because of the `allow_high_bytes` check above.
262-
Ok(T::from(value as u8))
262+
Ok(T::from(value))
263263
};
264264
}
265265
'u' => return scan_unicode(chars, mode.allow_unicode_escapes()).map(T::from),
@@ -300,7 +300,7 @@ fn scan_unicode(chars: &mut Chars<'_>, allow_unicode_escapes: bool) -> Result<ch
300300
return Err(EscapeError::UnicodeEscapeInByte);
301301
}
302302

303-
break std::char::from_u32(value).ok_or_else(|| {
303+
break std::char::from_u32(value).ok_or({
304304
if value > 0x10FFFF {
305305
EscapeError::OutOfRangeUnicodeEscape
306306
} else {

compiler/rustc_llvm/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
5050
fn restore_library_path() {
5151
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
5252
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
53-
env::set_var(&key, &env);
53+
env::set_var(&key, env);
5454
} else {
5555
env::remove_var(&key);
5656
}

compiler/rustc_macros/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
println!("cargo:rerun-if-changed=build.rs");
33
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
4-
if !std::env::var("RUSTC_BOOTSTRAP").is_ok() {
4+
if std::env::var("RUSTC_BOOTSTRAP").is_err() {
55
eprintln!(
66
"error: you are attempting to build the compiler without going through bootstrap"
77
);

tests/ui/codemap_tests/huge_multispan_highlight.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ compile-flags: --error-format=human --color=always
22
//@ ignore-windows
3-
// Temporary until next release:
4-
//@ ignore-stage2
53
fn main() {
64
let _ = match true {
75
true => (

tests/ui/codemap_tests/huge_multispan_highlight.svg

+3-3
Loading
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@ check-pass
22
//@ ignore-windows
33
//@ compile-flags: -Cremark=foo --error-format=human --color=always
4-
// Temporary until next release:
5-
//@ ignore-stage2
64
fn main() {}

tests/ui/error-emitter/highlighting.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
//@ compile-flags: --error-format=human --color=always
44
//@ error-pattern:for<'a> 
55
//@ edition:2018
6-
// Temporary until next release:
7-
//@ ignore-stage2
86

97
use core::pin::Pin;
108
use core::future::Future;

tests/ui/error-emitter/highlighting.svg

+2-2
Loading

tests/ui/error-emitter/highlighting.windows.svg

+2-2
Loading

tests/ui/error-emitter/multiline-multipart-suggestion.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ compile-flags: --error-format=human --color=always
22
//@ error-pattern: missing lifetime specifier
3-
// Temporary until next release:
4-
//@ ignore-stage2
53

64
fn short(foo_bar: &Vec<&i32>) -> &i32 {
75
&12

tests/ui/error-emitter/multiline-multipart-suggestion.svg

+3-3
Loading

tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg

+3-3
Loading

0 commit comments

Comments
 (0)