From 4a257c6bad11b400c186601509b73ce281f6f944 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 9 Dec 2018 12:24:30 +0100 Subject: [PATCH] Don't import println in main.rs --- blog/content/second-edition/posts/03-vga-text-buffer/index.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/blog/content/second-edition/posts/03-vga-text-buffer/index.md b/blog/content/second-edition/posts/03-vga-text-buffer/index.md index 429041b3..38881fbf 100644 --- a/blog/content/second-edition/posts/03-vga-text-buffer/index.md +++ b/blog/content/second-edition/posts/03-vga-text-buffer/index.md @@ -628,8 +628,6 @@ Now we can use `println` in our `_start` function: ```rust // in src/main.rs -use crate::println; - #[no_mangle] pub extern "C" fn _start() { println!("Hello World{}", "!"); @@ -638,7 +636,7 @@ pub extern "C" fn _start() { } ``` -We have to explicitly import the `println` macro in order to use it. This is different from the standard library where the `println` macro is implicitly imported. Note that the macros live directly under the crate root (i.e. `crate::println` instead of `crate::vga_buffer::println`) because of the `#[macro_export]` attribute. +Note that we don't have to import the macro in the main function, because it already lives in the root namespace. As expected, we now see a _“Hello World!”_ on the screen: