mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
Auto merge of #15052 - lnicola:fmt-arguments, r=Veykril
minor: Rename minicore ArgumentV1 to match libcore
This commit is contained in:
commit
51939db8d3
2 changed files with 12 additions and 15 deletions
|
@ -474,7 +474,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9333..9341,
|
range: 9286..9294,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
@ -487,7 +487,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9365..9369,
|
range: 9318..9322,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
@ -511,7 +511,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9333..9341,
|
range: 9286..9294,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
@ -524,7 +524,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9365..9369,
|
range: 9318..9322,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
@ -548,7 +548,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9333..9341,
|
range: 9286..9294,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
@ -561,7 +561,7 @@ fn main() {
|
||||||
file_id: FileId(
|
file_id: FileId(
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
range: 9365..9369,
|
range: 9318..9322,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
tooltip: "",
|
tooltip: "",
|
||||||
|
|
|
@ -867,29 +867,26 @@ pub mod fmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[lang = "format_argument"]
|
#[lang = "format_argument"]
|
||||||
pub struct ArgumentV1<'a> {
|
pub struct Argument<'a> {
|
||||||
value: &'a Opaque,
|
value: &'a Opaque,
|
||||||
formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
|
formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ArgumentV1<'a> {
|
impl<'a> Argument<'a> {
|
||||||
pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> ArgumentV1<'b> {
|
pub fn new<'b, T>(x: &'b T, f: fn(&T, &mut Formatter<'_>) -> Result) -> Argument<'b> {
|
||||||
use crate::mem::transmute;
|
use crate::mem::transmute;
|
||||||
unsafe { ArgumentV1 { formatter: transmute(f), value: transmute(x) } }
|
unsafe { Argument { formatter: transmute(f), value: transmute(x) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[lang = "format_arguments"]
|
#[lang = "format_arguments"]
|
||||||
pub struct Arguments<'a> {
|
pub struct Arguments<'a> {
|
||||||
pieces: &'a [&'static str],
|
pieces: &'a [&'static str],
|
||||||
args: &'a [ArgumentV1<'a>],
|
args: &'a [Argument<'a>],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Arguments<'a> {
|
impl<'a> Arguments<'a> {
|
||||||
pub const fn new_v1(
|
pub const fn new_v1(pieces: &'a [&'static str], args: &'a [Argument<'a>]) -> Arguments<'a> {
|
||||||
pieces: &'a [&'static str],
|
|
||||||
args: &'a [ArgumentV1<'a>],
|
|
||||||
) -> Arguments<'a> {
|
|
||||||
Arguments { pieces, args }
|
Arguments { pieces, args }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue