diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-30 02:42:33 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-13 10:39:23 +0100 |
| commit | e839b2ec849246ec5efe5069c8d874dbef289462 (patch) | |
| tree | 36489d29fe26c85fd9f283335acfb37d4915ee40 /src/librustc_save_analysis | |
| parent | 2e6eaceedeeda764056eb0e2134735793533770d (diff) | |
| download | rust-e839b2ec849246ec5efe5069c8d874dbef289462.tar.gz rust-e839b2ec849246ec5efe5069c8d874dbef289462.zip | |
Constness -> enum Const { Yes(Span), No }
Same idea for `Unsafety` & use new span for better diagnostics.
Diffstat (limited to 'src/librustc_save_analysis')
| -rw-r--r-- | src/librustc_save_analysis/sig.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 6401cabdcd5..820202c85ab 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -225,7 +225,7 @@ impl Sig for ast::Ty { text.push('>'); } - if f.unsafety == ast::Unsafety::Unsafe { + if let ast::Unsafe::Yes(_) = f.unsafety { text.push_str("unsafe "); } push_extern(&mut text, f.ext); @@ -365,13 +365,13 @@ impl Sig for ast::Item { } ast::ItemKind::Fn(ast::FnSig { ref decl, header }, ref generics, _) => { let mut text = String::new(); - if header.constness.node == ast::Constness::Const { + if let ast::Const::Yes(_) = header.constness { text.push_str("const "); } if header.asyncness.node.is_async() { text.push_str("async "); } - if header.unsafety == ast::Unsafety::Unsafe { + if let ast::Unsafe::Yes(_) = header.unsafety { text.push_str("unsafe "); } push_extern(&mut text, header.ext); @@ -453,7 +453,7 @@ impl Sig for ast::Item { text.push_str("auto "); } - if unsafety == ast::Unsafety::Unsafe { + if let ast::Unsafe::Yes(_) = unsafety { text.push_str("unsafe "); } text.push_str("trait "); @@ -496,11 +496,11 @@ impl Sig for ast::Item { if let ast::Defaultness::Default = defaultness { text.push_str("default "); } - if unsafety == ast::Unsafety::Unsafe { + if let ast::Unsafe::Yes(_) = unsafety { text.push_str("unsafe "); } text.push_str("impl"); - if constness == ast::Constness::Const { + if let ast::Const::Yes(_) = constness { text.push_str(" const"); } @@ -884,13 +884,13 @@ fn make_method_signature( ) -> Result { // FIXME code dup with function signature let mut text = String::new(); - if m.header.constness.node == ast::Constness::Const { + if let ast::Const::Yes(_) = m.header.constness { text.push_str("const "); } if m.header.asyncness.node.is_async() { text.push_str("async "); } - if m.header.unsafety == ast::Unsafety::Unsafe { + if let ast::Unsafe::Yes(_) = m.header.unsafety { text.push_str("unsafe "); } push_extern(&mut text, m.header.ext); |
