1
Fork 0

Rollup merge of #137807 - GuillaumeGomez:doctest-qualify-result, r=notriddle

Fully qualify `Result` in generated doctest code

As discussed in https://lore.kernel.org/rust-for-linux/20250228132553.880126-1-guillaume1.gomez@gmail.com/T/#u, it would require less code for RfL to be able to reach the same result (pun unintended).

cc ``@ojeda``

r? ``@notriddle``
This commit is contained in:
Matthias Krüger 2025-03-01 16:03:12 +01:00 committed by GitHub
commit 643c19c160
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -208,7 +208,7 @@ impl DocTestBuilder {
let (main_pre, main_post) = if returns_result {
(
format!(
"fn main() {{ {inner_attr}fn {inner_fn_name}() -> Result<(), impl core::fmt::Debug> {{\n",
"fn main() {{ {inner_attr}fn {inner_fn_name}() -> core::result::Result<(), impl core::fmt::Debug> {{\n",
),
format!("\n}} {inner_fn_name}().unwrap() }}"),
)

View file

@ -316,7 +316,7 @@ let mut input = String::new();
io::stdin().read_line(&mut input)?;
Ok::<(), io:Error>(())";
let expected = "#![allow(unused)]
fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {
fn main() { fn _inner() -> core::result::Result<(), impl core::fmt::Debug> {
use std::io;
let mut input = String::new();
io::stdin().read_line(&mut input)?;